unaiverse.networking.session¶
The session layer of the SDK. Each node keeps one Session with every peer it talks to on each of its two networks. The Session runs the handshake and sends keep-alives to detect a peer that stopped answering. It survives short losses of the link and ends with a goodbye (see Networking). The layer sits between the transport that carries the frames (unaiverse.networking.p2p) and the connection pools of the node (unaiverse.networking.node.connpool). The pools own one manager per network and dispatch the events of the Sessions to the node.
The table lists the three modules of the package from the bottom up.
| Module | Content |
|---|---|
sess_msg |
The messages of the Session (SessMsg) with their codec, the protocol identifiers, the capability bits, the reason codes and the values of the decision hook. It imports nothing from the other two. |
session |
The state machine of one Session (Session), its states, its roles and its events. |
session_manager |
The registry of the Sessions of one network (SessionManager): it routes the inbound messages, drives the timers, breaks simultaneous opens, quarantines peers and cuts the transport of ended Sessions. |
The node creates two managers and drives them once per cycle. A developer therefore uses this package directly only to write a decision policy (see ProfileDecisionResult) or to read the events and the states that the logs show. Importing the package loads none of the generated classes of the binary message format. Because these classes are loaded only when a message is encoded or decoded, the same code runs in the browser runtime.
Exports¶
The package re-exports these names from its modules (__all__). Each one is documented on the page of its module.
| Name | Kind | Defined in |
|---|---|---|
Session |
class | session |
SessionState |
str enum |
session |
SessionRole |
str enum |
session |
SessionEvent |
dataclass | session |
SessionEventType |
str enum |
session |
SessionManager |
class | session_manager |
SessMsg |
dataclass | sess_msg |
ProfileDecisionResult |
dataclass | sess_msg |
WorldGrantSpec |
dataclass | sess_msg |
VerifiedTokenClaims |
frozen dataclass | sess_msg |
SESSION_HELLO_PROTOCOL |
str |
sess_msg |
SESSION_PROFILE_PROTOCOL |
str |
sess_msg |
SESSION_WORLD_PROTOCOL |
str |
sess_msg |
SESSION_CONTROL_PROTOCOL |
str |
sess_msg |
SESSION_PROTOCOL_IDS |
frozenset[str] |
sess_msg |
The reason codes, the capability bits and reason_name are not re-exported and are imported from unaiverse.networking.session.sess_msg.