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:

CH CH CH CH CH CH CH CH CH CH CH CH CH CH CH CH DN SN SN SN SN // SN of the sender 🔴 AN AN AN AN AN AN AN AN AN AN AN AN AN AN AN AN // AN of the ID coin DN SN TO TO TO // SN of the receiver 🔴 ID ID ID ID // Message ID IX IX // Index of stripe, server keeps and returns this but does not process TS TS TS TS // Timestamp (UNIX Epoch, seconds) MS MS MS .. // Message body (variable length, up to 1400 bytes) E3 E3 // EOM Marker

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:

CH CH CH CH CH CH CH CH CH CH CH CH CH CH CH CH DN OW OW OW OW // SN of the receiver (changed) 🔴 AN AN AN AN AN AN AN AN AN AN AN AN AN AN AN AN // AN of the ID coin ID ID ID ID // First message ID ID ID ID ID // Second message ID ID ID ID ID // Third message ID // === These fields may refer to Get_V2 (future use) === // RW // Number of rows * 100. So 0x01 means return 100 rows. 00 Means max rows. (future use) // YR // The Year 00 = 2000. 255 = 2255. Time must be in UTC (future use) // MM // Month (future use) // DY // Day of Month (future use) // RT // Return Code. 00=stripe 01=mirror, 11 = 2nd mirror, FF Stripe, Mirror and 2nd Mirror (future use) // ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID // Reserved for Future Use. Put random numbers. (future use) E3 E3 // EOM Marker

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:

NM NM // Number of messages SN SN SN ID ID ID ID TS TS TS TS IX IX // SN of the sender ("FROM") + Message ID + TimeStamp + Index of stripe SN SN SN ID ID ID ID TS TS TS TS IX IX // Second message header SN SN SN ID ID ID ID TS TS TS TS IX IX // Third message header MS MS MS .. // First message body (variable length) MS MS MS .. // Second message body MS MS MS .. // Third message body E3 E3 // EOM Marker

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:

CH CH CH CH CH CH CH CH CH CH CH CH CH CH CH CH DN TO TO TO TO // SN of the receiver (Changed) 🔴 AN AN AN AN AN AN AN AN AN AN AN AN AN AN AN AN // AN of the ID coin

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):

ID ID ID ID FR FR FR ML ML // First message ID + Sender + Message Length ID ID ID ID FR FR FR ML ML // Second message ID + Sender + length ID ID ID ID FR FR FR ML ML // Third message ID + Sender + length E3 E3 // EOM Marker

Note:

Message IDs are sorted by timestamp in ascending order (oldest first).