kuchain-socket
v2.3.8
Published
2.0实时数据@kc/socket
Downloads
3
Readme
@kc/socket
websocket 连接和订阅管理库
Runtime
node/browser
Usage
import * as ws from '@kc/socket';
ws.debug();
ws.setHost('https://kitchen-v2.kucoin.net');
const socket = ws.getInstance();
const Topic = ws.Topic;
socket.connect({
sessionPrivate: false,
});
socket.subscribe(Topic.get(Topic.MARKET_LEVEL2, { SYMBOLS: ['BTC-USDT'] }));
socket.topicMessage('/trade/snapshot', 'trade.snapshot', true)((arr) => {
console.log(arr);
});