Closed physicsai closed 5 years ago
Hi, you can change minReconnectionDelay
option
For example:
const ws = new ReconnectingWebSocket(url, '', {minReconnectionDelay: 1}); // 1 millisecond
Anyway, you're right, by default, the first connection attempt should be immediate. I will change that.
Thank you, @pladaria. With the the minReconnectionDelay
option, ReconnectingWebSocket
also connects instantaneously.
it would indeed be great to have the first attempt to be immediate!
Yes please! Happy to come across this issue. Thanks for your work on this module!
@pladaria any idea on when you could fix this?
I've just opened a pull request here: #94
Wow thanks, this option has made my application go from being slow to instant!
I was relying on the reconnect method combined with a URL function to change the URL without reassociating handler. Edit: It seems this also applied to the initial connection, as specified above.
I suggest that calling the reconnect() method should reconnect immediately (like the initial connection) as it's an explicit action. The automatic reconnects should still be throttled.
Almost a year passed and a huge delay before the first connection is still here. Why is this the default behavior? I can't imagine a single use case where this will not ruin the user experience. C'mon the lib is nice, just fix this issue finally please
The fix has been sitting in this open PR since Nov 2018 https://github.com/pladaria/reconnecting-websocket/pull/94 . It appears @pladaria is not maintaining the lib anymore. Does anyone know of an active fork of this project? I think that's what's needed to actually solve this, unfortunately.
Fixed in #94
I have a simple app for asynchronous message passing, using websockets (React + Django).
If I use
WebSocket
, the connection opens almost instantaneously upon loading the page, whereas if I switch toReconnectingWebSocket
(that's the only change in the code and usingimport ReconnectingWebSocket from 'reconnecting-websocket';
), it takes around 3-5 seconds.Is the reason behind this delay understood?