Chat and Messaging Services
Services that allow secure message exchange between users.
The RAIDA provides three services for messaging: POST MESSAGE, GET MESSAGE, and POLL MESSAGES.
Command Codes
Command Code | Service |
---|---|
173 | POST MESSAGE |
174 | GET MESSAGE |
172 | POLL MESSAGE |
Note:
The request headers will be exactly the same as used today, as will the response headers. The bodies will be different. It is assumed (at the moment) that both sender and receiver are identified by their IdCoins.
POST MESSAGE
(Command Code - 173 (0xAD))
POST Body Structure has fixed fields:
IX (Index of stripe):
The client breaks the data into many stripes and each stripe is labeled so the receiver knows how to put it back together.
Request Format:
Response Status Codes:
Status | Code | Description |
---|---|---|
Success | 250 | Message successfully posted |
Message ID already exists | 171 | It is not possible to send the same Message ID to the same receiver twice or more |
GET MESSAGE
(Command Code - 174 (0xAE))
Downloads up to 1400 bytes of messages.
Body Structure for three messages:
The service will respond with up to 1400 bytes of data. Messages are packed into a single request without any separators. Each response is prepended with a block of fixed-length headers (13 bytes - SN(3) + ID(4) + TS(4) + IX(2)). Length of each message body is known to client from the POLL request.
Messages are returned in the same order as they were requested.
If client requests a handful of messages which do not fit into a single frame, "Chat: Requested Messages Too Long" (172) is returned. For three messages it means that sum of bodies lengths should not be greater than 1400 - 13 * 3 = 1361 bytes.
If message with given Message ID could not be retrieved (e.g., it has been already downloaded), it is skipped.
Response Format:
Response Status Codes:
Status | Code | Description |
---|---|---|
AllPass | 241 | All requested messages were sent |
AllFail | 242 | None of the requested messages were sent (no response body) |
Mixed | 243 | Only some of the requested messages were sent |
Requested Messages Too Long | 172 | The requested messages do not fit into a single frame |
For "AllPass" and "Mixed" statuses, the total number of actually returned messages is returned in bytes 0-1 (big-endian) of the response body.
POLL MESSAGE
(Command Code - 172 (0xAC))
Note:
This service requires authentication. A user must not be able to look into other users' inboxes.
Request Header:
Response Status Codes:
Status | Code | Description |
---|---|---|
Success | 250 | There are messages |
Fail | 251 | There are no messages |
FailToAuth | 64 | Receiver's IdCoin is counterfeit |
"Success" response body for three pending messages (MAX - 100):
Note:
Message IDs are sorted by timestamp in ascending order (oldest first).