cexio-api-node icon indicating copy to clipboard operation
cexio-api-node copied to clipboard

Getting data with socket.io

Open prajit21 opened this issue 6 years ago • 0 comments

hello, we using cex-api-node with node js. and we have passed data through soket.io it's working perfectly. we can get data from cex api but its not continue sometimes its stuck.

Code

const cexWS = new CEXIO(apiKey, apiSecret).ws

cexWS.open()

cexWS.on('open', function () { cexWS.auth() cexWS.subscribeTick() cexWS.subscribeTicker() cexWS.subscribeOHLCV() })

cexWS.on('auth', function () { cexWS.subscribeOrderBook('BTC-USD', true, 1) })

cexWS.on('message', function (msg) { io.emit('msg',msg); if (msg.e === 'ping') { cexWS.authTicker('BTC-USD') } })

prajit21 avatar Jul 02 '18 06:07 prajit21