small wrapper around websocket that does message buffering and reconnects
Buffers messages and sends them once the connection has been established.
Also offers a
.connect() method to re-establish a broken connection.
$ npm install websocket-buffering $ component install Swatinem/websocket-buffering
new WebSocketBuffering(url, [options])
Creates a new WebSocket connection to
options.connect is set to
false, it will not automatically connect
options.buffering is set to
false, it will throw when sending on a closed
socket instead of buffering and sending once the socket is open.
This is the readyState as defined by WebSocket.
ws.OPEN and so on.
Send data down the wire, or buffer it to be sent once the connection is actually open.
This opens up a new connection when it is not open yet. Does nothing otherwise.
Event: 'error' (err)
Event: 'message' (message)
Released as free software as part of ChatGrape