[feature] Automatically reconnect to HMR with exponential backoff#785
[feature] Automatically reconnect to HMR with exponential backoff#785
Conversation
🦋 Changeset detectedLatest commit: 96db4d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
||
| ws.addEventListener('message', handleMessage); | ||
| ws.addEventListener('error', handleError); | ||
| ws.addEventListener('close', reconnect); |
There was a problem hiding this comment.
We could also listen for something like focussing (or visibilitychange) the browser again. This removes the need for exponential backoff, ...
There was a problem hiding this comment.
Yes, that's a great idea. Thtat's what I'm using to run my code for waking up ios wrapper app
There was a problem hiding this comment.
since the exponential dropoff with 30s limit will not solve the case for a sleep longer than 30s, but visibilitychange certainly would.
Thanks guys!
|
Size Change: +372 B (0%) Total Size: 769 kB
ℹ️ View Unchanged
|
* implement focus-based reconnect * Update client.js * Create brown-gorillas-notice.md
| ws.addEventListener('close', reconnect); | ||
| } | ||
|
|
||
| function reconnect() { |
There was a problem hiding this comment.
Currently reconnect only gets called once, should this be called again if establishing connection in connect(false) fails?
No description provided.