Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep Trying to connect… after Disconnected #26

Closed
nitin2953 opened this issue May 13, 2022 · 6 comments
Closed

Keep Trying to connect… after Disconnected #26

nitin2953 opened this issue May 13, 2022 · 6 comments

Comments

@nitin2953
Copy link

nitin2953 commented May 13, 2022

After terminating 11ty --serve, it keep Trying to connect… & logging into browser console

[11ty][12:07:39.465 UTC] Trying to connect…                  reload-client.js:21
[11ty][12:07:39.772 UTC] Connected                           reload-client.js:21

[11ty][12:08:40.546 UTC] Disconnected                        reload-client.js:21
[11ty][12:09:18.706 UTC] Trying to connect…                 reload-client.js:160
▼ WebSocket connection to 'ws://localhost:5555/' failed:     reload-client.js:21
    init @ reload-client.js:160
    reconnect @ reload-client.js:88

It should suppress WebSocket connection failed (? and Trying to connect… ?) warning
which will result:

(99) [11ty][12:09:18.706 UTC] Trying to connect…            reload-client.js:160
@nitin2953 nitin2953 changed the title Keep trying to connect after "Disconnected" Keep trying to connect after Disconnected May 13, 2022
@nitin2953 nitin2953 changed the title Keep trying to connect after Disconnected Keep Trying to connect… after Disconnected May 13, 2022
@zachleat
Copy link
Member

Just as a quick note I believe it only attempts a reconnect on page focus or visibilitychange

@nitin2953
Copy link
Author

nitin2953 commented May 20, 2022

Yes, it is only working on page focus AND visibilitychange

@nitin2953 nitin2953 reopened this May 20, 2022
@zachleat
Copy link
Member

Ah, sorry I think there has been a misunderstanding here? This is intentional behavior—we attempt to reconnect when you focus to the browser window.

If the server is down when you focus (or the tab’s visibility changes), it will report an error.

It doesn’t seem like this error is swallow-able via try catch, unfortunately. Some additional info here https://stackoverflow.com/questions/31002592/javascript-doesnt-catch-error-in-websocket-instantiation

If you’d like to request an option to this behavior, I can convert this one to be an enhancement request, though it feels like lower priority to me at the moment

@zachleat
Copy link
Member

This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.

If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and we will reopen the issue. Thanks!

@zachleat
Copy link
Member

Just one more small note here I did play around with adding an error handler to the websocket but that resulted in two errors in the console, which is not what we want 😅

zachleat added a commit that referenced this issue Jun 17, 2022
@nitin2953
Copy link
Author

If you’d like to request an option to this behavior, I can convert this one to be an enhancement request, though it feels like lower priority to me at the moment

I just want it to "Stop Reconnecting after Disconnection"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants