To install unix-socket-leader, simply use npm:
npm install unix-socket-leader --save
The example below can be found here and ran using
node example.js. It
demonstrates how to use unix-socket-leader to build a simple chat room.
'use strict'var leader = 'chat'var eos =var sockets =var popts = end: falseleaderleaderleader
Creates a new instance of unix-socket-leader.
leader, emitted when this instance is elected leader
client, emitted when this instance is connected to a leader (even itself); the first argument is the connected socket
connection, emitted when there is a new incoming connection, and this instance is the leader; the first argument is the connected socket
Closes the instance, severing all current connections.
Copyright Matteo Collina 2015, Licensed under MIT.