update changelog, do some tiny adjustment

This commit is contained in:
OttoMao
2015-08-12 20:05:47 +08:00
parent 531f4d0421
commit 130610fed6
7 changed files with 93 additions and 74 deletions

View File

@@ -47,7 +47,8 @@ function resToMsg(msg,cb){
//config.port
function wsServer(config){
//web socket interface
var wss = new WebSocketServer({port: config.port});
var self = this,
wss = new WebSocketServer({port: config.port});
wss.broadcast = function(data) {
var key = data.id;
if(typeof data == "object"){
@@ -86,9 +87,12 @@ function wsServer(config){
}
});
//Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding
return wss;
self.wss = wss;
}
wsServer.prototype.closeAll = function(){
var self = this;
self.wss.close();
}
module.exports = wsServer;