Skip to content

Conversation

@sansyrox
Copy link
Member

Description

This PR fixes #

Summary

This PR does....

PR Checklist

Please ensure that:

  • The PR contains a descriptive title
  • The PR contains a descriptive summary of the changes
  • You build and test your changes before submitting a PR.
  • You have added relevant documentation
  • You have added relevant tests. We prefer integration tests wherever possible

Pre-Commit Instructions:

@vercel
Copy link

vercel bot commented Jul 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
robyn ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 1:42pm

elif state == 1:
await websocket.send_text("Whooo??")
elif state == 2:
await websocket._connector.async_broadcast(websocket.query_params.get("one", ""))
Copy link

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.

Suggested change
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)


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'))
Copy link

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.

📚 Relevant Docs

Suggested change
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)

@recurseml
Copy link

recurseml bot commented Jul 23, 2025

😱 Found 2 issues. Time to roll up your sleeves! 😱

Need help? Join our Discord for support!
https://discord.gg/qEjHQk64Z9

@sansyrox sansyrox force-pushed the feat/implement-websockets branch from 1a968d6 to a589c5f Compare July 23, 2025 21:21
@sansyrox sansyrox changed the title wip : Feat/implement websockets feat: implement the new websocket syntax Jul 23, 2025
@sansyrox sansyrox force-pushed the feat/implement-websockets branch from fb2cc95 to 91c548b Compare July 24, 2025 13:41
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

Successfully merging this pull request may close these issues.

2 participants