Skip to content

Improvement/websocket improvements#18

Merged
twestos merged 4 commits intomainfrom
improvement/websocket-improvements
Jun 7, 2025
Merged

Improvement/websocket improvements#18
twestos merged 4 commits intomainfrom
improvement/websocket-improvements

Conversation

@twestos
Copy link
Owner

@twestos twestos commented Jun 7, 2025

This pull request updates WebSocket handler signatures and documentation to improve clarity and align with best practices. The changes replace the req and sid parameters with data and client_id, respectively, across all WebSocket handlers. Additionally, the documentation has been updated to reflect these changes and provide guidance on the new handler structure.

Updates to WebSocket Handler Signatures:

  • Replaced req (WebSocketRequest object) with data (message content) and sid (session ID) with client_id (unique connection ID) in all WebSocket handler functions. This change applies to connection, disconnection, message handling, and registration handlers. ([[1]](https://github.com/twestos/Daebus/pull/18/files#diff-dc2f38725ac51f5eeb644431bee4f8b6f4a0a88a7eebfc10eeae63af68481f5bL129-R138), [[2]](https://github.com/twestos/Daebus/pull/18/files#diff-dc2f38725ac51f5eeb644431bee4f8b6f4a0a88a7eebfc10eeae63af68481f5bL382-R382), [[3]](https://github.com/twestos/Daebus/pull/18/files#diff-dc2f38725ac51f5eeb644431bee4f8b6f4a0a88a7eebfc10eeae63af68481f5bL512-R514), [[4]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L64-R127), [[5]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L100-R148), [[6]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L134-R171), [[7]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L294-R401), [[8]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L562-R672), [[9]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L589-R702), [[10]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L620-R744), [[11]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L677-R771), [[12]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L689-R789), [[13]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L712-R804), [[14]](https://github.com/twestos/Daebus/pull/18/files#diff-f96fbc5114a04cf997b180403f892d0e2b60d3bf3033d8ed52a9feb74f844caaL165-R166), [[15]](https://github.com/twestos/Daebus/pull/18/files#diff-f96fbc5114a04cf997b180403f892d0e2b60d3bf3033d8ed52a9feb74f844caaL268-R268))

Documentation Enhancements:

  • Added a detailed explanation of the new WebSocket handler signature, including examples of how data and client_id are used. ([docs/src/content/docs/guides/websockets.mdR35-R83](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63R35-R83))
  • Updated all code examples to use the new data and client_id parameters, ensuring consistency across the documentation. ([[1]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63R528-R549), [[2]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L492-R594), [[3]](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L514-R608))
  • Included guidance on accessing the full request context when necessary, using the request proxy. ([docs/src/content/docs/guides/websockets.mdL294-R401](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L294-R401))
  • Added a section on deprecation warnings related to the websockets library, clarifying their impact and future resolution. ([docs/src/content/docs/guides/websockets.mdR854-R864](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63R854-R864))

Minor Improvements:

  • Simplified the rate-limiting configuration by renaming messages_per_minute to max_messages for clarity. ([docs/src/content/docs/guides/websockets.mdL395-R476](https://github.com/twestos/Daebus/pull/18/files#diff-d5d32e51c463b01e94723bbbe5b336a6dc20da1788f50950c9e9a841981b7f63L395-R476))

Copilot AI review requested due to automatic review settings June 7, 2025 07:12
@vercel
Copy link

vercel bot commented Jun 7, 2025

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

Name Status Preview Comments Updated (UTC)
daebus ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2025 7:15am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances clarity and consistency in WebSocket handler signatures and supporting documentation by replacing the older parameters (req, sid) with (data, client_id) and updating examples accordingly.

  • Consolidated parameter names for WebSocket handlers across connection, disconnection, message, and registration events.
  • Updated all relevant documentation and code examples, including blueprint examples and deprecation warnings.
  • Simplified rate-limiting configuration by renaming a configuration parameter.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
docs/src/content/docs/overview.md Updated WebSocket handler signatures in code examples for consistent parameter naming
docs/src/content/docs/guides/websockets.md Revised handler definitions and enhanced documentation with new parameter names and examples
docs/src/content/docs/guides/blueprint.md Aligned blueprint examples with new WebSocket handler signatures

@twestos twestos merged commit 4af29c6 into main Jun 7, 2025
5 checks passed
@twestos twestos deleted the improvement/websocket-improvements branch June 7, 2025 07:17
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.

1 participant