Event Name
leave-pr-room
Description
Leave a WebSocket room for a specific pull request. After leaving, you’ll no longer receive real-time notifications for that pull request room.Connection Setup
First, establish a WebSocket connection to the Diffy API:Payload
The ID of the pull request room to leave
The username of the user leaving the room
Request Example
Server Responses
When a user leaves a PR room, the server emits multiple events to all remaining clients in the room:left Event
Broadcast to all remaining users in the room when someone leaves.
Notification message indicating who left and from which PRExample:
"johndoe left PR 123"user-count Event
Sent to all remaining users in the room with the updated user count.
The total number of users still in the room (after the user left)
active-users Event
Sent to all remaining users in the room with the updated list of active usernames.
Array of usernames currently remaining in the room
Listening for Responses
Complete Example
Room Architecture
Diffy uses a room-based architecture where each pull request has its own dedicated room. The room identifier follows the patternpr:{pullRequestId}. When you leave a room, you’re removed from that specific pull request’s channel.
Notes
- Users are automatically removed from the room upon emitting this event
- All remaining users in the room receive notifications when someone leaves
- The user count and active users list are updated for all remaining participants
- Leaving a room does not disconnect you from the WebSocket server; you remain connected and can join other rooms
- It’s good practice to leave rooms when navigating away from a pull request view