WebSocket API
The WebSocket server handles real-time stroke synchronization. It is built using the wslibrary and utilizes a simple JSON-based messaging protocol.
Connection
ws://localhost:8080?token=YOUR_CLERK_TOKENClient-to-Server Events
join_room
Subscribe to events for a specific room.
{
"type": "join_room",
"roomId": 123
}chat
Send a new stroke or message to the room.
{
"type": "chat",
"roomId": 123,
"message": "{ strokeData: '...' }"
}Server-to-Client Events
Clients will receive messages when other participants perform actions.
New Message/Stroke
{
"type": "chat",
"message": "{ strokeData: '...' }",
"roomId": 123
}