Skip to content

Send & Receive Message



wss message

So, it’s pretty simple: it makes a message on the server and sends it to everyone else.

NameTypeDescription
idstringIdentifier of the message
cidstringConversation ID the message belongs to
xobjectOptional extra parameters for the message
bodystringText content of the message
attachmentsarray[object]List of attachments (files, images, etc.)
replied_message_idstringID of the message being replied to (optional)
forwarded_message_idstringID of the message being forwarded (optional)
deleted_forarray[string]List of user IDs for whom the message is deleted (optional)

On each message sent to server - a server will deliver back to client a simple packet with message id and timestamp at which the message was stored in DB so both sender & recipient will have same date sent time stored:

{
ack: {
mid: "63480e68f4794709f802a2fa",
server_mid: "63480e68f4794709f802a2fa",
t: 15673838833,
modified: { body: "new body", ... }
}
}
{
"message": {
"id": "5а34p21m0xj23",
"body": "hey how is going?",
"cid": "63480e68f4794709f802a2fa",
"x": {
"param1": "value",
"param2": "value"
},
"attachments": [{
"file_id": "15c64c2b988f13a2d821d76c",
"file_name": "image_6.png",
"file_blur_hash": "U27nLE$*00_N^k,@s9xu#7$2$%xtVD-B-pkW",
"file_content_type": "image/png",
"file_width": 370,
"file_height": 754
},
{
"file_id": "15c64c2b988f13a2d821d86s",
"file_name": "video_1.png",
"file_content_type": "image/video",
"file_width": 589,
"file_height": 354
},
...
]
}
}

All conversation’s participants who is online will receive the following message in real-time:

{
"message": {
"_id": "63480e68f4794709f802a2fa",
"t": 15673838833,
"from": "634ec51c0b65918393dca5bf",
"body": "hey how is going?",
"cid": "63480e68f4794709f802a2fa",
"x": {
"param1": "value",
"param2": "value"
},
"attachments": [{
"file_id": "15c64c2b988f13a2d821d76c",
"file_name": "image_6.png",
"file_blur_hash": "U27nLE$*00_N^k,@s9xu#7$2$%xtVD-B-pkW",
"file_content_type": "image/png",
"file_width": 370,
"file_height": 754
},
{
"file_id": "15c64c2b988f13a2d821d86s",
"file_name": "video_1.png",
"file_content_type": "image/video",
"file_width": 589,
"file_height": 354
},
...
]
"created_at": "2025-08-13T05:51:44.733Z",
}
}

Additionally, all conversation’s participants who is offline will receive the following push notification:

{
"title": "UserName",
"body": "MessageText",
"firstAttachmentUrl": "url",
"cid": "63480e68f4794709f802a2fa"
}