Real-time chat server with WebSocket support for bidirectional messaging and reactions.
User identification is automatic based on client IP address. All messages are broadcast to all connected clients.
development Serverws://localhost:8080/wsDevelopment server
/ws OperationSend a new chat message
sendMessageClient sends a message that will be broadcast to all connected clients
send_messagesendMessage| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | additional properties are allowed |
| type | string | - | const ("send_message") |
- | required |
| data | object | - | - | - | required, additional properties are allowed |
| data.text | string | Message content | - | <= 500 characters | required |
| data.author_name | string | Display name for the author | default ("Anonymous") |
- | - |
Examples of payload (generated)
{
"type": "send_message",
"data": {
"text": "string",
"author_name": "Anonymous"
}
}
/ws OperationToggle reaction on a message
addReactionAdd or remove a reaction. If user already reacted with this emoji, it will be removed
add_reactionaddReaction| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | additional properties are allowed |
| type | string | - | const ("add_reaction") |
- | required |
| data | object | - | - | - | required, additional properties are allowed |
| data.message_id | string | ID of the message to react to | - | format (uuid) |
required |
| data.emoji | string | Emoji character | - | - | required |
Examples of payload (generated)
{
"type": "add_reaction",
"data": {
"message_id": "d7d9d9fd-478f-40e6-b651-49b7f19878a2",
"emoji": "string"
}
}
/ws OperationReceive new messages
receiveMessageServer broadcasts new messages to all connected clients. On connection, all existing messages are sent
messagemessage| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | additional properties are allowed |
| type | string | - | const ("message") |
- | required |
| data | object | - | - | - | required, additional properties are allowed |
| data.id | string | Unique message identifier | - | format (uuid) |
required |
| data.text | string | Message content | - | - | required |
| data.author_id | string | User ID based on client IP | - | - | required |
| data.author_name | string | Display name | - | - | required |
| data.created_at | integer | Unix timestamp in seconds | - | format (int64) |
required |
| data.reactions | object | Map of emoji to array of user IDs who reacted | - | - | required |
| data.reactions (additional properties) | array<string> | - | - | - | - |
| data.reactions (single item) | string | - | - | - | - |
Examples of payload (generated)
{
"type": "message",
"data": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"text": "string",
"author_id": "string",
"author_name": "string",
"created_at": 0,
"reactions": {
"property1": [
"string"
],
"property2": [
"string"
]
}
}
}
/ws OperationReceive reaction updates
receiveReactionUpdateServer broadcasts reaction changes with the full updated message
reaction_updatedreactionUpdated| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | additional properties are allowed |
| type | string | - | const ("reaction_updated") |
- | required |
| data | object | - | - | - | required, additional properties are allowed |
| data.message_id | string | - | - | format (uuid) |
required |
| data.emoji | string | - | - | - | required |
| data.user_id | string | - | - | - | required |
| data.action | string | - | allowed ("added", "removed") |
- | required |
| data.message | object | - | - | - | required, additional properties are allowed |
| data.message.id | string | Unique message identifier | - | format (uuid) |
required |
| data.message.text | string | Message content | - | - | required |
| data.message.author_id | string | User ID based on client IP | - | - | required |
| data.message.author_name | string | Display name | - | - | required |
| data.message.created_at | integer | Unix timestamp in seconds | - | format (int64) |
required |
| data.message.reactions | object | Map of emoji to array of user IDs who reacted | - | - | required |
| data.message.reactions (additional properties) | array<string> | - | - | - | - |
| data.message.reactions (single item) | string | - | - | - | - |
Examples of payload (generated)
{
"type": "reaction_updated",
"data": {
"message_id": "d7d9d9fd-478f-40e6-b651-49b7f19878a2",
"emoji": "string",
"user_id": "string",
"action": "added",
"message": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"text": "string",
"author_id": "string",
"author_name": "string",
"created_at": 0,
"reactions": {
"property1": [
"string"
],
"property2": [
"string"
]
}
}
}
}
/ws OperationReceive error messages
receiveErrorServer sends error messages when rate limits are exceeded or validation fails
errorerror| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | additional properties are allowed |
| type | string | - | const ("error") |
- | required |
| data | object | - | - | - | required, additional properties are allowed |
| data.error | string | Error message | examples ("Rate limit exceeded. Maximum 60 messages per minute.", "Invalid message format", "message text cannot be empty", "message too long (max 500 characters)") |
- | required |
Examples of payload (generated)
{
"type": "error",
"data": {
"error": "Rate limit exceeded. Maximum 60 messages per minute."
}
}