socket-server
v0.0.4
Published
Websocket server - extends the excellent https://github.com/einaros/ws
Downloads
12
Readme
socket-server
Websocket server - extends the excellent https://github.com/einaros/ws
// same params as ws
var svr = require('./socketserver.js')({port: 8080});
// hook connection attempt
svr.hook = function(ws){
console.log('hooked');
// set ws.deny = true to deny connection
return ws;
}
// list of connected clients
var clients = svr.clientlist;
// send object or string to all clients
svr.sendAll({some: 'thing'});
// send to a particular client id only
svr.send('adsed290', {some: 'thing'});
// view debugging info
$ debug=1 myapp.js