Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/folkloreinc/node-client-manager

A really simple script to manage clients in node.js
https://github.com/folkloreinc/node-client-manager

Last synced: about 2 months ago
JSON representation

A really simple script to manage clients in node.js

Awesome Lists containing this project

README

        

Client-manager
===========

A really simple script to manage clients

Installation
---------------
npm install client-manager

Usage
---------------

var io = require('socket.io');
var clientManager = require('client-manager');

var io = require('socket.io').listen(80);

var manager = clientManager();

io.sockets.on('connection', function (socket) {

manager.addClient(socket.id,socket);

socket.on('disconnect', function () {
manager.removeClient(socket.id);
});

});

manager.on('add',function(client) {
console.log('A client as been added');
});

manager.on('empty',function(client) {
console.log('There is no more clients');
});