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

Firefox cannot establish the websocket connection but other browsers and firefox private browsing can. #2954

Open
kj4tmp opened this issue Apr 24, 2024 · 8 comments

Comments

@kj4tmp
Copy link
Contributor

kj4tmp commented Apr 24, 2024

Description

It looks like firefox cannot connect to the websocket while other browsers can.
I believe this issue has been present for a few months.
This issue seems to only present itself when starting the app multiple times (while developing). I have not been able to reproduce the issue when the app is run inside a docker container and the entire docker container is restarted / rebuilt between code changes.

The issue is also present when restarting the app multiple times inside a docker container without restarting the entire container (when using vscode devcontainers), indicating the issue is present on windows and linux(WSL).

Here is how I can produce the issue:

  1. Write main.py
  2. run it using python main.py

image

nicegui version: 1.4.18
windows 11
python 3.11.19

main.py:

from nicegui import ui

ui.button("click me!", on_click=lambda: ui.notify('clicked!'))

ui.run(
    port=80,
    title="test",
    favicon="🚀",
    reload=False,
    storage_secret="redacted",
    show=False,
    uvicorn_logging_level="debug",
)

Sometimes, Firefox reports error in the web developer tools:

Firefox can’t establish a connection to the server at ws://localhost/_nicegui_ws/socket.io/?client_id=5cd0b96f-d751-4877-b732-1bbabb013077&EIO=4&transport=websocket. socket.io.min.js:6:17426

The connection to ws://localhost/_nicegui_ws/socket.io/?client_id=5cd0b96f-d751-4877-b732-1bbabb013077&EIO=4&transport=websocket was interrupted while the page was loading. socket.io.min.js:6:17426

and the page refreshes periodically while showing sometimes:

  1. a white page, or
  2. the expected content but nothing happens when clicking things.

Firefox can connect again when in private browsing:

image

@kj4tmp
Copy link
Contributor Author

kj4tmp commented Apr 24, 2024

the working browser shown above is Edge

@kj4tmp
Copy link
Contributor Author

kj4tmp commented Apr 24, 2024

I suspect it has something to do with the browser cache.

@rodja
Copy link
Member

rodja commented Apr 25, 2024

Can anyone else reproduce this issue?

@kj4tmp
Copy link
Contributor Author

kj4tmp commented Apr 25, 2024

it may require making small changes to the code (add / remove the button) between restarts to trigger the firefox failure

@me21
Copy link
Contributor

me21 commented Apr 29, 2024

Firefox works for me and my project. Probably one of the extensions interferes since the problem doesn't exist in private mode?.. 🤔
I start the app using Debug in PyCharm IDE.
If you suspect the cache is the issue, does reloading the page with Ctrl+F5 (bypassing the cache) help?

@kj4tmp
Copy link
Contributor Author

kj4tmp commented Apr 29, 2024

I was not able to repeat the issue after re-installing the Adblock Ultimate Extension. I think I was running a multi-year old version of the extension.

@kj4tmp kj4tmp closed this as completed Apr 29, 2024
@kj4tmp
Copy link
Contributor Author

kj4tmp commented Apr 29, 2024

nevermind the issue is back.

Issue persists after:

  1. Removing all extensions
  2. ctrl + F5

@kj4tmp kj4tmp reopened this Apr 29, 2024
@kj4tmp
Copy link
Contributor Author

kj4tmp commented Apr 29, 2024

restarting firefox in "troubleshooting mode" also seems to fix the issue (from the hamburger menu -> help -> troubleshooting mode

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

No branches or pull requests

3 participants