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 serialized as a binary structure using a BinaryWriter. Fields are written sequentially and read back with a BinaryReader.

FieldData TypeRequiredDescription
typeint32YesThe SpixiMessageCode that defines the purpose and structure of the data field.
dataLengthint32YesThe byte length of the data field. A value of 0 indicates no payload.
databyte[]NoThe SpixiMessage payload for this message type. Present only if dataLength > 0.
channelint32NoAn identifier for a specific chat channel. Defaults to 0 if not present. Read only if remaining bytes are available.
groupAddressIxiBytesNoThe address of the group this message belongs to. Present only for group messages. Read only if remaining bytes are available.
groupSenderAddressIxiBytesNoThe address of the original sender within a group. Used by the group owner when forwarding messages to other participants, and when hideParticipantAddresses mode is active. Sender can set this value to their address and send it to the group owner, to indicate that it needs to be forwarded to other group participants (this is useful when the sender doesn't have all group participants added as contacts). Read together with groupAddress.

[!NOTE] The channel, groupAddress, and groupSenderAddress fields are optional during deserialization for backward compatibility. The deserializer checks for remaining bytes before attempting to read each field.


Spixi Message Codes

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

Chat & Streaming

CodeNameDescription
0chatA standard text chat message.
53chatStreamA streaming chat message with incremental content delivery.

Profile

CodeNameDescription
1getNickRequests the nickname of a contact.
2nickProvides the nickname of a contact.
24avatarSends an avatar image.
25getAvatarRequests the avatar for a contact.

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.
35msgTypingIndicates that the user is currently typing a 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.
42keys2Exchanges session keys for end-to-end encryption.
26getPubKeyRequests the public key of a contact.
27pubKeyProvides a public key in response to a request.
52createGroupInstructs participants to join a peer-to-peer group chat.

Transactions

CodeNameDescription
49transactionRequestA request to initiate a transaction with a peer.
48transactionSendSends transaction data to a peer.
46transactionSendRequestA request to send a transaction via the peer's node.
47transactionSendResponseThe response to a transactionSendRequest.

Secure Connections

CodeNameDescription
50openSecureConnectionOpens a direct secure (IXI Socket) connection with a peer.
51closeSecureConnectionCloses an active secure connection.

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.

Deprecated

CodeNameDescription
3requestAddLegacy contact request. Superseded by requestAdd2 (40).
4acceptAddLegacy contact accept. Superseded by acceptAdd2 (41).
5sentFundsLegacy funds notification. Deprecated in favor of transactionRequest (49).
6requestFundsLegacy payment request. Deprecated in favor of transactionSend (48).
7keysLegacy key exchange. Superseded by keys2 (42).
18requestFundsResponseLegacy response to requestFunds.

Reserved

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