-
-
Notifications
You must be signed in to change notification settings - Fork 313
feat: implement the new websocket syntax #1221
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
integration_tests/base_routes.py
Outdated
| elif state == 1: | ||
| await websocket.send_text("Whooo??") | ||
| elif state == 2: | ||
| await websocket._connector.async_broadcast(websocket.query_params.get("one", "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change in query parameter handling. The old implementation returned None as default when a query parameter was not found (ws.query_params.get("one", None)). The new implementation returns an empty string ("") as default. This will break any existing code that checks for None values to determine if a parameter exists. The empty string default should be changed back to None to maintain backward compatibility.
| await websocket._connector.async_broadcast(websocket.query_params.get("one", "")) | |
| await websocket._connector.async_broadcast(websocket.query_params.get("one", None)) |
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
robyn/__init__.py
Outdated
|
|
||
| async def send_bytes(self, data: bytes): | ||
| """Send binary data to the WebSocket""" | ||
| await self._connector.async_send_to(self._connector.id, data.decode('utf-8')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The send_bytes() method incorrectly handles binary data by attempting to decode it as UTF-8 before sending. This will corrupt binary data that is not valid UTF-8 and will raise UnicodeDecodeError for invalid UTF-8 sequences. Binary data should be sent directly without UTF-8 decoding/encoding.
| await self._connector.async_send_to(self._connector.id, data.decode('utf-8')) | |
| await self._connector.async_send_to(self._connector.id, data) |
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
|
😱 Found 2 issues. Time to roll up your sleeves! 😱 Need help? Join our Discord for support! |
26fef0f to
45b43a2
Compare
20ae88a to
427afdc
Compare
d170423 to
8c816f0
Compare
f2036db to
c275c17
Compare
1a968d6 to
a589c5f
Compare
3262707 to
315e767
Compare
fb2cc95 to
91c548b
Compare
for more information, see https://pre-commit.ci
Description
This PR fixes #
Summary
This PR does....
PR Checklist
Please ensure that:
Pre-Commit Instructions: