Created
April 4, 2020 01:41
-
-
Save YasunoriMATSUOKA/ae9b5ff3eb617d14db60d1e6adeb5179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = "wss://ws.zaif.jp/stream?currency_pair=btc_jpy" | |
const WebSocket = require('ws') | |
const wss = new WebSocket(url) | |
wss.on('open', () => { | |
console.log('Connection open') | |
}) | |
wss.on('close', () => { | |
console.log('Connection close') | |
}) | |
wss.on('message', (dataString) => { | |
console.log('New message') | |
const json = JSON.parse(dataString) | |
console.log(json) | |
}) | |
setTimeout(() => { | |
wss.terminate() | |
}, 10000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment