With current stream method there is no way to know about underlying websocket connection errors and handle them when necessary.
Returning an event emitter decorating WebSocketConnection (or directly the WebSocketConnection event emitter) would allow to do that.
What do you think about something like (stream: string, recieved: (message: {event: string, payload: any}) => void): Promise<WebSocketConnection> instead of current stream: string, recieved: (message: {event: string, payload: any}) => void) ?
With current
streammethod there is no way to know about underlying websocket connection errors and handle them when necessary.Returning an event emitter decorating WebSocketConnection (or directly the WebSocketConnection event emitter) would allow to do that.
What do you think about something like
(stream: string, recieved: (message: {event: string, payload: any}) => void): Promise<WebSocketConnection>instead of currentstream: string, recieved: (message: {event: string, payload: any}) => void)?