diff options
Diffstat (limited to 'binance.js')
| -rw-r--r-- | binance.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/binance.js b/binance.js new file mode 100644 index 00000000..8edcc5da --- /dev/null +++ b/binance.js @@ -0,0 +1,14 @@ +const WebSocket = require("ws"); + +module.exports = app => { + const binance = new WebSocket( + "wss://stream.binance.com:9443/ws/btcusdt@ticker" + ); + + binance.onmessage = async function(event) { + let msg = JSON.parse(event.data); + app.set("bid", msg.b); + app.set("ask", msg.a); + app.set("last", msg.l); + }; +}; |
