smart-websocket
Features
- autoReconnect: In non-user disconnected case, the websocket is automatically reconnected after disconnecting
- smartSend: The message will not be sent until the Websocket is opened
DEMO
Installing
npm i -S smart-websocket
or
yarn add smart-websocket
Usage
let socket = URL OPTIONS
Options
defaultOptions = autoOpen: true smartSend: true autoReconnect: true reconnectDelay: 500 maxReconnectCount: 3
Methods
socketsocketsocket
Events
socketsocket // When the connection is successfully opened, reconnectCount will be set to 0socketsocketsocket