Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/folkloreinc/node-client-manager
- Owner: folkloreinc
- License: other
- Created: 2012-12-04T20:18:24.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-10T05:06:08.000Z (about 12 years ago)
- Last Synced: 2024-10-13T06:22:54.032Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Client-manager
===========A really simple script to manage clients
Installation
---------------
npm install client-managerUsage
---------------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');
});