Synapsis
Inter connect local machines together with a Express like socket router. Data transfer is cipphered with Diffie Hellman algorithm (dynamic public / private key exchange between peers based on a shared password).
Usage
Instanciate Peer
Instanciate new peer:
var Synapsis = ; var synapse = namespace: 'namespace-name' password: 'long-password-16-random-caracters-recommended' // Identity will be shared to all peers identity: name : hostname ; // Now start the peersynapsestart;
Expose Socket Routes
Now expose socket routes that can be triggered by other peers:
synapse; synapse;
Send/Broadcast Actions to Peers
To send actions to other peers:
// Broadcast a message to all nodes (w/o current) and do not wait for responsesynapse; // Broadcast a message + data to all nodes (w/o current) and do not wait for responsesynapse; // Broadcast a message to all nodes (w/o current) and receive messages from each (RPC like)synapse;
Or send to a specific peer:
var peer = synapse0; synapse; synapse; synapse;
Event Handling
synapse; synapse; synapse; synapse;
Test
Checkout test/ folder for more examples/
License
MIT