elm-lang / websocket

Websockets for Elm
http://package.elm-lang.org/packages/elm-lang/websocket/latest
BSD 3-Clause "New" or "Revised" License
99 stars 30 forks source link

Exponential backoff does not work #17

Open bgourlie opened 7 years ago

bgourlie commented 7 years ago

Elm Version: 0.18 OS: Mac OS X Browser: Chrome SSCCE:

Because this is a bug internal to the websocket library, it can't be illustrated in an isolated example. Here are the simplest steps to reproduce:

Detailed description:

The BadOpen message is never dispatched, presumably because the Die message is dispatched with every failed connect attempt. This appears to be happening because the native websocket onClose handler is fired every failed connect attempt, and then onSelfMsg handles the Die message, resetting the connection state.

It appears that the browser itself does some sort of connection throttling, which may be why this issue has gone unnoticed.

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

drathier commented 6 years ago

I have seen exponential backoff in chrome (just a few minutes ago), but seem to get a constant rate of about 5 retries per second in safari doing the same thing. Now I'm getting one request every 3 seconds in chrome.

bgourlie commented 6 years ago

I suspect that the behavior you’re witnessing is throttling enforced by the browser. It’s been a while since I debugged this issue, but that’s what I recall. On Sat, Dec 9, 2017 at 6:54 AM Filip Haglund notifications@github.com wrote:

I have seen exponential backoff in chrome (just a few minutes ago), but seem to get a constant rate of about 5 retries per second in safari doing the same thing. Now I'm getting one request every 3 seconds in chrome.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elm-lang/websocket/issues/17#issuecomment-350461081, or mute the thread https://github.com/notifications/unsubscribe-auth/AA80zLNe8IeavykXOd4aRtOrxEJl_sAnks5s-oMKgaJpZM4L-l4V .