Spixi Message Protocol

A SpixiMessage is the application-level payload carried within the encrypted data field of a StreamMessage. It represents the actual command or content being sent between users, such as a chat message, a file transfer request, or a contact request.

Serialization Structure

A SpixiMessage is a simple, typed data container.

FieldData TypeMinMaxDescription
typeint32The SpixiMessageCode that defines the purpose and structure of the data field.
dataIxiBytesThe SpixiMessage payload for this message type.
channelint32An identifier for a specific chat channel.

Spixi Message Codes

The type field determines how the data payload should be interpreted. The following codes are defined.

Chat & Profile

CodeNameDescription
0chatA standard text chat message.
1getNickRequests the nickname of a contact.
2nickProvides the nickname of a contact.
24avatarSends an avatar image.
25getAvatarRequests the avatar for a contact.
35msgTypingIndicates that the user is currently typing a message.

Messaging Status & Reactions

CodeNameDescription
8msgReadConfirmation that a message has been read by the recipient.
9msgReceivedConfirmation that a message has been delivered to the recipient's device.
33msgDeleteA request to delete a previously sent message.
34msgReactionAdds a reaction (e.g., an emoji) to a specific message.
36msgErrorReports an error in processing a previous message.
39msgReportReports a message for moderation or abuse (e.g. for group servers/bots).

Contact & Group Management

CodeNameDescription
19acceptAddBotA specialized request that the peer who accepted the contact request is a bot.
37leaveA notification that a user is leaving a group chat.
38leaveConfirmedConfirmation that the leave request was processed.
40requestAdd2A request to add a user as a contact.
41acceptAdd2Accepts a contact request.
26getPubKeyRequests the public key of a contact.
27pubKeyProvides a public key in response to a request.
42keys2Exchanges session keys for end-to-end encryption.

Funds & Transactions

CodeNameDescription
5sentFundsA notification that funds have been sent.
6requestFundsA request for a payment from a contact.
18requestFundsResponseThe response to a requestFunds message.

File Transfer

CodeNameDescription
10fileDataA chunk of a file's binary data.
11requestFileDataRequests a specific chunk of a file.
12fileHeaderContains metadata about a file being sent (name, size, type).
13acceptFileThe recipient agrees to accept an incoming file transfer.
23fileFullyReceivedConfirmation that all chunks of a file have been received.

Voice/Video Calls

CodeNameDescription
14requestCallInitiates a voice or video call.
15acceptCallAccepts an incoming call request.
16rejectCallRejects an incoming call request.
17callDataA chunk of real-time audio or video data.

Generic Application Layer

CodeNameDescription
21appDataGeneric data for a mini-app or service.
22appRequestA generic request to a mini-app or service.
28appRequestAcceptAccepts an appRequest.
29appRequestRejectRejects an appRequest.
30appRequestErrorSignals an error occurred during an appRequest.
31appEndSessionTerminates a session with a mini-app.
43getAppProtocolsRequests the list of app protocols supported by the peer.
44appProtocolsProvides the list of supported app protocols.
45appProtocolDataGeneric data for a specific, named app protocol.

Bot Interaction

CodeNameDescription
20botGetMessagesA request used by a bot to fetch messages from a channel.
32botActionA generic action or command sent to a bot.

Reserved

CodeNameDescription
240-255reservedThe range 0xF0 to 0xFF is reserved for custom, user-defined applications.