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

ui.run_with with mount_path is broken #2515

Closed
aersam opened this issue Feb 5, 2024 · 1 comment · Fixed by #2521
Closed

ui.run_with with mount_path is broken #2515

aersam opened this issue Feb 5, 2024 · 1 comment · Fixed by #2521
Assignees
Labels
bug Something isn't working
Milestone

Comments

@aersam
Copy link
Contributor

aersam commented Feb 5, 2024

Description

Hi there

I tried embedding nicegui with an existing app under a mount path like this:

ui.run_with(
    app,
    mount_path="/nicegui",
    storage_secret=os.getenv("NICEGUI_STORAGE_SECRET", "fA3478GN$N$*wT60#--"),
)

However, this breaks the websocket connection. as a workaround I did this:

import nicegui.nicegui

nicegui.nicegui.sio_app.engineio_path = "/nicegui" + nicegui.nicegui.sio_app.engineio_path

The issue seeems to be that the sio_app in nicegui.py hardcodes the path:

sio_app = socketio.ASGIApp(socketio_server=sio, socketio_path='/_nicegui_ws/socket.io'), while the fronend assumes it's under the mount_path. I guess you had to overwrite that engineio_path in the run_with method

@rodja
Copy link
Member

rodja commented Feb 6, 2024

I traced the error back to python-engineio where it hopefully gets fixed with my pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants