Closed DenisCarriere closed 5 years ago
This library is meant to be a "drop-in" replacement for WebSocket libraries that implement the WebSocket API.
reconnecting-websocket
tries to be compatible with WebSockets from browser, React Native and any API compatible library. Many of the client options defined for ws
are not aplicable.
If you want to use full ws
capabilities, you can, simply create a new Class extending it:
import WS from `ws`;
import RWS from `reconnecting-websocket`;
...
class MyWebSocket extends WS {
constructor(url, protocol) {
super(/*pass here your ws options*/)
}
}
// Then you can use reconnecting-websocket
const rws = new RWS("url", [], {WebSocket: MyWebSocket, etc});
Would it be possible to add the same
options
as@types/ws
, that way it's a simple "drop-in" forws
with the extra features of reconnecting.Client Option types from
@types/ws