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§
- Broadcast
Report - Outcome of a broadcast.
- Incoming
Message - An incoming message received from a peer via WebSocket.
- Peer
Registry - Manages peer state and WebSocket connections.
- Peer
Registry Options - Options for
PeerRegistry::with_options. - Peer
State - A peer’s state in the session registry.
Enums§
- Peer
Event - Events emitted by the session layer when peer state changes.
- Session
Error - Errors from Layer 5 session operations.
Functions§
- format_
peer_ ref - Format a
PeerState::peer_ref/ user-facingPeer.peer_ref.