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

@ -1,3 +1,9 @@
31 July: AnyProxy 3.7.3:
* show lastest 100 records when visit the web ui
* save map-local config file to local file
* show an indicator when filter or map-local is in use
31 July: AnyProxy 3.7.2: 31 July: AnyProxy 3.7.2:
* bugfix for issue #29 * bugfix for issue #29

View File

@ -47,7 +47,8 @@ function resToMsg(msg,cb){
//config.port //config.port
function wsServer(config){ function wsServer(config){
//web socket interface //web socket interface
var wss = new WebSocketServer({port: config.port}); var self = this,
wss = new WebSocketServer({port: config.port});
wss.broadcast = function(data) { wss.broadcast = function(data) {
var key = data.id; var key = data.id;
if(typeof data == "object"){ 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 self.wss = wss;
}
return wss; wsServer.prototype.closeAll = function(){
var self = this;
self.wss.close();
} }
module.exports = wsServer; module.exports = wsServer;

View File

@ -64,7 +64,8 @@ function proxyServer(option){
proxyConfigPort = option.webConfigPort || DEFAULT_CONFIG_PORT, //port to ui config server proxyConfigPort = option.webConfigPort || DEFAULT_CONFIG_PORT, //port to ui config server
disableWebInterface = !!option.disableWebInterface, disableWebInterface = !!option.disableWebInterface,
ifSilent = !!option.silent, ifSilent = !!option.silent,
webServerInstance; webServerInstance,
ws;
if(ifSilent){ if(ifSilent){
logUtil.setPrintStatus(false); logUtil.setPrintStatus(false);
@ -130,7 +131,7 @@ function proxyServer(option){
//start web socket service //start web socket service
function(callback){ function(callback){
var ws = new wsServer({port : socketPort}); ws = new wsServer({port : socketPort});
callback(null) callback(null)
}, },

View File

@ -26,11 +26,12 @@ function anyproxy_wsUtil(config){
var self = this; var self = this;
var baseUrl = config.baseUrl || "127.0.0.1", var baseUrl = config.baseUrl || "127.0.0.1",
socketPort = config.port || 8003; socketPort = config.port || 8003,
dataSocket;
var dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
function initSocket(){
self.bodyCbMap = {}; self.bodyCbMap = {};
dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
dataSocket.onmessage = function(event){ dataSocket.onmessage = function(event){
config.onGetData && config.onGetData.call(self,event.data); config.onGetData && config.onGetData.call(self,event.data);
@ -66,6 +67,9 @@ function anyproxy_wsUtil(config){
} }
self.dataSocket = dataSocket; self.dataSocket = dataSocket;
}
initSocket();
}; };
anyproxy_wsUtil.prototype.send = function(data){ anyproxy_wsUtil.prototype.send = function(data){

View File

@ -436,11 +436,12 @@
var self = this; var self = this;
var baseUrl = config.baseUrl || "127.0.0.1", var baseUrl = config.baseUrl || "127.0.0.1",
socketPort = config.port || 8003; socketPort = config.port || 8003,
dataSocket;
var dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
function initSocket(){
self.bodyCbMap = {}; self.bodyCbMap = {};
dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
dataSocket.onmessage = function(event){ dataSocket.onmessage = function(event){
config.onGetData && config.onGetData.call(self,event.data); config.onGetData && config.onGetData.call(self,event.data);
@ -476,6 +477,9 @@
} }
self.dataSocket = dataSocket; self.dataSocket = dataSocket;
}
initSocket();
}; };
anyproxy_wsUtil.prototype.send = function(data){ anyproxy_wsUtil.prototype.send = function(data){