diff options
| author | Adam Soltys <[email protected]> | 2020-05-17 21:44:11 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-05-17 21:44:11 -0700 |
| commit | 11724003fbbcd12b90b27dc370c9537eb1bbcbf2 (patch) | |
| tree | 0316c9441de4fbae9487d90a8d334d7c1c476a9e /lib | |
| parent | 56f05870ff6cc9100683ba017b6f6b4818a47f7f (diff) | |
| download | coinos-server-11724003fbbcd12b90b27dc370c9537eb1bbcbf2.tar.gz coinos-server-11724003fbbcd12b90b27dc370c9537eb1bbcbf2.zip | |
more logging
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/binance.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/binance.js b/lib/binance.js index 2f4f7ef7..151ce6a7 100644 --- a/lib/binance.js +++ b/lib/binance.js @@ -1,11 +1,21 @@ const WebSocket = require("ws"); module.exports = () => { + l.info("connecting to binance"); binance = new WebSocket( "wss://stream.binance.com:9443/ws/btcusdt@ticker" ); + binance.onopen = function(event) { + l.info("binance socket opened"); + }; + + binance.onerror = function(event) { + l.error("binance socket error", event); + }; + binance.onmessage = async function(event) { + l.info("got rates from binance"); try { let msg = JSON.parse(event.data); app.set("bid", msg.b); @@ -21,6 +31,7 @@ module.exports = () => { }); app.set("rates", rates); + l.info("saved binance rates"); } catch(e) { l.error("binance socket error", e); } |
