websocketplus
v1.0.1
Published
A simple implementation of websocket auto-reconnection
Downloads
1
Readme
Websocket Plus
A simple implementation of websocket auto-reconnection for ws
Installation
npm i websocketplus --save
Example
npm run example
Usage
const WebSocketPlus = require('websocketplus')
const webSocketPlus = new WebSocketPlus('wss://ws-feed.pro.coinbase.com', {
openMessage: {
type: "subscribe",
product_ids: ["BTC-USD"],
channels: ["level2"]
}
})
webSocketPlus.on('open', () => {});
webSocketPlus.on('error', (message) => {
console.log('error', message);
});
webSocketPlus.on('close', (message) => {
console.log('close', message);
});
webSocketPlus.on('message', (message) => {
console.log('message', message.type);
});