Skip to main content

Instant Messaging

The Demos SDK ships two instant-messaging client classes under the instantMessaging namespace. Both use the same E2E encryption layer (ml-kem-aes for key encapsulation and AES-GCM, ml-dsa for the registration proof key), but they target different transports and delivery guarantees:
ClassDefault portTransportHistoryOffline deliveryDelivery acknowledgementWhen to use
L2PSMessagingPeer3006L2PS messaging serverYes — history() API with paginationYes — server queues messages for offline peersYes — message_sent / message_queued framesProduction. L2PS-backed messaging with persistence and L2PS pipeline (mempool → batch → L1 proof → L1 finality).
MessagingPeer3005Legacy signaling serverNoNoNoTransient relay-only messaging. Kept for backwards compatibility.
The default reader of these docs should reach for L2PSMessagingPeer. Every code example below uses it unless explicitly labeled “legacy”.

Where to go next

What is the Instant Messaging Protocol?

The L2PS-backed protocol, plus how the legacy signaling-only path differs.

Architecture overview

Port 3005 vs port 3006, and the L2PS pipeline.

Quickstart

Connect, send, receive, and read history with L2PSMessagingPeer.

API reference

Method-by-method reference for both classes.

Message types

Wire-protocol message types for each class.

Encryption

The shared ml-kem-aes E2E layer.

FAQ

Common questions, including which class to pick.