Students reviewing a classmate’s code should be able to click a line, leave a comment, and see new comments and replies appear instantly for everyone viewing the same submission—no page reload. Please build the backend that powers this real-time experience. When a reviewer opens a submission, they receive the existing comment thread; adding a line comment or replying should immediately broadcast to all viewers of that submission’s page.

We’re using Micronaut (Java) and MongoDB. Each submission acts as its own real-time channel, and the connection must require a bearer token. Provide a WebSocket endpoint at /v1/submissions/{submissionId}/review-comments with these message types:
- Client → Server: ADD_COMMENT { lineNumber, text }, REPLY_TO_COMMENT { parentCommentId, text }
- Server → Clients: NEW_COMMENT and NEW_REPLY containing the full objects (id, lineNumber, author, text, replies)

Design the data model and message flow to be reliable and fast, and ensure permission checks are enforced.