Skip to content

ui.run_with with mount_path is broken #2515

Closed
@aersam

Description

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

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions