npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

fourdsocketproxy

v3.1.0

Published

A socket bridge between a browser fourd instance and node.js code.

Downloads

8

Readme

FourDSocketProxy

Joshua Marshall Moore

May 28th, 2018

Overview

10 by 10 grid

FourD is a browser library for dynamically displaying force directed graphs. FourDSocketProxy brings that power to Node.js.

Installation

npm install fourdsocketproxy

Usage

FourDSocketProxy comprises two systems, the browser frontend, and the socket server.

To run fourd, import the init function, and wait for the promise to resolve, like so:

var SIZE = 5;
require('fourdsocketproxy')().then(fourd =>{
    fourd.clear();
    var options = {cube: {size: 10, color: 0x0000ff}};

    var depths = [];
    for(var k=0; k<SIZE; k++){
        var rows = [];
        for(var i=0; i<SIZE; i++){
            var column = [];
            for(var j=0; j<SIZE; j++){
                column.push(fourd.add_vertex(options));
                if(j>0){
                    fourd.add_edge(column[j], column[j-1]);
                }
                if(i>0){
                    fourd.add_edge(column[j], rows[i-1][j]);
                }
                if(k>0){
                    fourd.add_edge(column[j], depths[k-1][i][j]);
                }
            }
            rows.push(column);
        }
        depths.push(rows);
    }
});

API

Calling require('fourdsocketproxy') doesn't do much, but returns a function; Call it, and you get a promise for a fourd object. The fourd object defines the following functions:

var a = fourd.add_vertex(vertex_options);
var b = fourd.add_vertex(vertex_options);

var e = fourd.add_edge(a, b);

fourd.remove_edge(e);
fourd.remove_vertex(a);
fourd.clear();

Options

The add_vertex function takes a small number of options:

var options = {cube: {size: 10, color: 0x000000}};
// or
var options = {cube: {size: 10, texture: 'path/to/img.jpg'}}

Callbacks

The fourd object is an EventEmitter, you can react to clicks on an individual vertex like so:

// initialization, as above ...
fourd.on('click', event => {
    console.log(`mouse click! button: ${event.button_id}, vertex_id: ${event.vertex_id}.`);
});

Etc.

The FourD frontend runs about 250 vertices. More are possible, but you might want to design around this limitation.

Acknowledgements

FourDSocketProxy uses

On the server, we have

And of course many thanks go out to Dr. Todd Veldhuizen for publishing Dynamic Multilevel Graph Visualization.