Skip to main content

Message Types

The two messaging clients use completely different wire protocols. Pick the section that matches the class you are using.

L2PSMessagingPeer protocol frames (port 3006)

Every frame on this protocol carries { type, payload, timestamp, requestId? }. The requestId correlates a server response with the client request that produced it.

Client → server

TypePurpose
registerRegister this connection with publicKey, l2psUid, and a signed proof of register:{publicKey}:{timestamp}.
sendSend an E2E encrypted message: { to, encrypted, messageHash }.
historyFetch conversation history with a peer: { peerKey, before?, limit?, proof } (signed history:{peerKey}:{timestamp}).
discoverList online peers in the current L2PS network.
request_public_keyLook up a peer’s public key by identifier: { targetId }.
ackReserved for client-initiated acknowledgements.

Server → client

TypePurpose
registeredRegistration succeeded: { success, publicKey, l2psUid, onlinePeers }.
messageIncoming E2E encrypted message: { from, encrypted, messageHash, offline? }.
message_sentDelivery confirmation for a send: { messageHash, l2psStatus: "submitted" | "failed" }.
message_queuedRecipient was offline; message stored for later: { messageHash, status: "queued" }.
history_responseHistory page: { messages: StoredMessage[], hasMore }.
discover_responseList of online peer public keys: { peers: string[] }.
public_key_responseLookup result: { targetId, publicKey: string | null }.
peer_joinedA peer joined the L2PS network: { publicKey }.
peer_leftA peer left the L2PS network: { publicKey }.
errorServer-side error: { code, message, details? }.

MessageStatus (in StoredMessage.status)

delivered, queued, sent, failed, l2ps_pending, l2ps_batched, l2ps_confirmed.

ErrorCode (in error frames)

INVALID_MESSAGE, REGISTRATION_REQUIRED, INVALID_PROOF, PEER_NOT_FOUND, L2PS_NOT_FOUND, L2PS_SUBMIT_FAILED, RATE_LIMITED, INTERNAL_ERROR.

MessageType (in MessageEnvelope.type)

text, media, reaction, system, transfer.

MessagingPeer protocol (legacy, port 3005)

The legacy signaling-server client uses a flat { type, payload } envelope (Message interface). The type is one of:
TypePurpose
registerRegister a new peer with the signaling server.
discoverRequest a list of all connected peers.
messageEncrypted peer-to-peer message (relayed by the signaling server).
peer_disconnectedNotification that a peer disconnected.
request_public_keyRequest a peer’s public key.
public_key_responseResponse containing a peer’s public key.
server_questionA question sent from the server to a peer.
peer_responseA peer’s response to a server question.
debug_questionDebug message used to trigger a server question.
errorError notification with { type, details }.
This protocol does not include history, message_sent, message_queued, peer_joined, peer_left, or ack — those are L2PSMessagingPeer-only.