WebSocket Protocol
Connect to wss://bantr.ing/ws (or ws://localhost:3001/ws for local dev).
Connection
On connection, the server sends a welcome message with recent messages:
json
{
"type": "welcome",
"userId": "A7B3F9X",
"messages": [...],
"rooms": ["welcome", "help", "onboarding"]
}Client → Server Messages
Send a message
json
{
"type": "message",
"userId": "A7B3F9X",
"content": "Hello, world!",
"roomId": "welcome"
}Join a room
json
{
"type": "join",
"roomId": "help"
}Leave a room
json
{
"type": "leave",
"roomId": "welcome"
}Ping
json
{ "type": "ping" }Server → Client Messages
New message
json
{
"type": "message",
"message": {
"id": "msg-abc123",
"userId": "A7B3F9X",
"content": "Hello!",
"country": "IL",
"flag": "🇮🇱",
"timestamp": "2026-02-22T09:15:00.000Z",
"roomId": "welcome"
}
}Error
json
{
"type": "error",
"message": "Free posts exhausted",
"freePostsRemaining": 0
}Reconnection
The client should implement automatic reconnection with a 3-second delay on disconnect.