Closed bennycode closed 6 years ago
I like the idea of using a Promise
for getUrl
(as addition to other options like string
or function
)
I've been trying to implement async flow here too, however registering event listeners in this current manner gets complicated requiring the event handlers to be passed into ReconnectingWebSocket as parameters.
Latest version supports passing () => Promise<string>
as url parameter
We have a use case where we need to execute a function before every WebSocket reconnect. It would be great if the
ReconnectingWebsocket
instance could execute a function (likebeforeReconnect
) on every reconnect.Another option, to fulfill our needs, would be making use of
Promises
forgetUrl
. But this requires theReconnectingWebsocket
to wait for aPromise
to resolve.Idea: