Commit 36c9375b by ken

depth

parent 602aa4e2
...@@ -67,7 +67,7 @@ const _handleSocketError = function(error) { ...@@ -67,7 +67,7 @@ const _handleSocketError = function(error) {
const _handleSocketOpen = function(opened_callback) { const _handleSocketOpen = function(opened_callback) {
console.log("open"); console.log("open");
for (const symbol of observerSymbol) { for (const symbol of observerSymbol) {
const req = {event: 'addChannel', channel: symbol + '_depth', isZip: 'true', binary: 'true'}; const req = {event: 'addChannel', channel: symbol + '_depth'};
console.log(JSON.stringify(req)); console.log(JSON.stringify(req));
this.send(JSON.stringify(req)); this.send(JSON.stringify(req));
} }
...@@ -99,9 +99,7 @@ const _subscribe = function(callback, opened_callback = false) { ...@@ -99,9 +99,7 @@ const _subscribe = function(callback, opened_callback = false) {
ws.on('close', _handleSocketClose.bind(ws)); ws.on('close', _handleSocketClose.bind(ws));
ws.on('message', function(data) { ws.on('message', function(data) {
try { try {
const text = pako.inflate(data); callback(JSON.parse(data));
console.log(text);
callback(JSON.parse(text));
} catch (error) { } catch (error) {
console.log('Parse error: '+error.message); console.log('Parse error: '+error.message);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment