Skip to main content

Module chat_mesh

Module chat_mesh 

Source
Expand description

Chat over the SocialWebNet mesh — bridge the chat-graph engine to peer tunnels.

Chat already has a serializable message (RelayEnvelope), a signer, and a transport-agnostic apply path (apply_incoming_envelope). Today those ride the HTTP relay; this module routes them over the mesh instead — peer-to-peer, no relay server.

It composes two lower layers:

Like mesh_channel, ChatMeshBridge is a pure state machine: it produces frames to send and envelopes delivered, but performs no socket I/O and touches no storage. The caller moves the frames with SocialWebNet::send_datagram(peer, ports::CHAT, ports::CHAT, frame) and applies each delivered envelope with crate::chat_relay::apply_incoming_envelope. This keeps the routing logic deterministically testable (two bridges exchanging a real envelope, with loss) and decoupled from the live mesh runtime, which lives in qualia-core-db.

Structs§

ChatMeshBridge
Per-peer reliable chat routing over the mesh. One bridge per node; it holds a ReliableEndpoint per peer DID.
InboundChat
The result of feeding one inbound frame to the bridge.
OutFrame
A reliable-channel frame destined for a specific peer. The caller frames it as a mesh datagram on ports::CHAT and sends it to peer_did.

Functions§

decode_envelope
Decode a CHAT-port payload back into a chat envelope. None if it is not a valid CBOR envelope.
encode_envelope
CBOR-encode a chat envelope for the CHAT-port payload.