small wrapper around websocket that does message buffering and reconnects
This is heavily inspired by stagas/websocket for the client side, but does the same wrapping for ws in node as well, to provide the same api.
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
Creates a new WebSocket connection to url
.
If options.connect
is set to false
, it will not automatically connect
If 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.
LGPLv3
Released as free software as part of ChatGrape