Enhance WebSocket collaboration handler and hub management#9
Merged
moutonjeremy merged 2 commits intomainfrom Apr 19, 2026
Merged
Enhance WebSocket collaboration handler and hub management#9moutonjeremy merged 2 commits intomainfrom
moutonjeremy merged 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new WebSocket-based collaboration backend, enabling real-time Y.js document synchronization. The implementation adds a scalable, room-based relay system for binary collaboration messages, integrates authentication via JWT tokens, and ensures proper resource management. It also updates the dependency injection and server/router setup to support the new collaboration feature.
New Collaboration WebSocket Backend
handler.go: Handles WebSocket upgrades, authenticates users via JWT, and manages WebSocket connections for Y.js rooms.hub.go: Manages the lifecycle of collaboration rooms, including creation, removal, and statistics.room.go: Implements room logic, client management, and message broadcasting between clients (pure relay for binary Y.js messages).Dependency Injection and Server Initialization
CollaborationHubin the dependency injection container and initialized it during server startup. [1] [2]HTTP Routing and Middleware Integration
/ws/collab/:roomId, including JWT authentication middleware and route setup in the HTTP router.Dependency Updates
go.mod(github.com/gofiber/websocket/v2,github.com/fasthttp/websocket,github.com/savsgio/gotils). [1] [2]Codebase Integration
This change lays the foundation for real-time collaborative editing features using Y.js and WebSockets, with robust authentication and room management.