Skip to main content

Module session

Module session 

Source
Expand description

Layer 5: Session — Peer identity, connection lifecycle, message routing.

The PeerRegistry is the central component. It consumes peer discovery events from Layer 3 (NetworkProvider) and manages transport connections from Layer 4 (StreamTransport, RawTransport).

§Layer rules

  • Layer 5 does NOT know what the data means (no namespaces, no envelopes)
  • Layer 5 does NOT inspect payloads
  • Layer 5 does NOT do peer discovery — it consumes Layer 3 events
  • Peers exist because Layer 3 says they exist, NOT because of connections
  • Connections are lazy — established on first send()
  • Layer 5 does NOT implement any transport protocol — it delegates to Layer 4

Re-exports§

pub use self::hello::HelloEnvelope;
pub use self::hello::HelloKind;
pub use self::hello::PeerIdentity;
pub use self::hello::CLOSE_APP_MISMATCH;
pub use self::hello::CLOSE_HELLO_PROTOCOL;
pub use self::hello::HELLO_TIMEOUT;

Modules§

hello
Hello envelope — Layer 5 identity handshake (RFC 017 §8).
reconnect
Exponential backoff tracker for reconnection attempts.

Structs§

BroadcastReport
Outcome of a broadcast.
IncomingMessage
An incoming message received from a peer via WebSocket.
PeerRegistry
Manages peer state and WebSocket connections.
PeerRegistryOptions
Options for PeerRegistry::with_options.
PeerState
A peer’s state in the session registry.

Enums§

PeerEvent
Events emitted by the session layer when peer state changes.
SessionError
Errors from Layer 5 session operations.

Functions§

format_peer_ref
Format a PeerState::peer_ref / user-facing Peer.peer_ref.