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

dev-server-core/WebSocketsManager: send periodic ping over WebSockets to prevent connection closure for inactivity #2821

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

larabr
Copy link

@larabr larabr commented Oct 9, 2024

What I did

  1. Added pinging mechanism over the web sockets to prevent unexpected connection closure after ~60s (with websocket error 1006) when testing on BrowserStack (Safari).

I couldn't get to the bottom of what exactly is causing the timeout, but sending periodic ping messages fixes it. I checked if the ws server is closing the connection, but it doesn't seem to be the case; using a ping to keep the connection alive is suggested here.

Copy link

changeset-bot bot commented Oct 9, 2024

⚠️ No Changeset found

Latest commit: c4e2bd0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@bashmish
Copy link
Member

Tricky one, I would love to have a stable solution for BrowserStack, many times my tests just randomly failed with timeouts in Firefox and Safari on BrowserStack.

However do you think it's a generic issue with WS or is it due to BrowserStack? If the latter, it would be better to implement this in the BrowserStack adapter

@larabr
Copy link
Author

larabr commented Oct 14, 2024

In this case I think it might be due to the Browserstack testing setup, because I couldn't repro with Playwright in local, but I'm not sure if it's a problem unique to the platform: based on other issues I've found around (incl. the one I linked), other network setups might be affected as well.

Edit: the Browserstack support team shared that they use mitmproxy to enable network logs on their side, so the inactivity timeout might come from there.

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

Successfully merging this pull request may close these issues.

2 participants