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

signaling-server-python not compatible with websockets v14 #1322

Open
SirNate0 opened this issue Jan 22, 2025 · 2 comments
Open

signaling-server-python not compatible with websockets v14 #1322

SirNate0 opened this issue Jan 22, 2025 · 2 comments

Comments

@SirNate0
Copy link

From their changelog:

The following aliases in the websockets package were switched to the new asyncio implementation:

from websockets import connect, unix_connext
from websockets import broadcast, serve, unix_serve

If you’re using any of them, then you must follow the upgrade guide immediately.

Alternatively, you may stick to the legacy asyncio implementation for now by importing it explicitly:

from websockets.legacy.client import connect, unix_connect
from websockets.legacy.server import broadcast, serve, unix_serve

In particular, when a client attempts to connect, the server will fail:

Listening on 127.0.0.1:8000
server listening on 127.0.0.1:8000
connection open
connection handler failed
Traceback (most recent call last):
  File "libdatachannel/examples/signaling-server-python/venv/lib/python3.10/site-packages/websockets/asyncio/server.py", line 374, in conn_handler
    await self.handler(connection)
TypeError: handle_websocket() missing 1 required positional argument: 'path'

Using the legacy serve() does seem to resolve the issue for the moment.

@SirNate0
Copy link
Author

The new version stores the URL path in the request attribute of the websocket ServerConnection. Specifically as ws.request.path where ws is the ServerConnection argument passed to the handler function when the websocket is opened.

@Nemirtingas
Copy link
Contributor

Hi, I confirm this, I've re-installed my test server 2 days ago and just installed the old websockets 12.

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

2 participants