Skip to content

unaiverse.networking.node

The node package holds the process that hosts an agent or a world and the pieces it is made of. A node registers the hosted entity on the UNaIVERSE account of its owner and describes it with a profile. It proves its identity with a token signed by the UNaIVERSE server and manages the connections with its peers. Each of these four jobs has a module.

Module Main object Role
node Node, NodeSynchronizer The node itself: registration, the main loop with its network task and its tick task, joining worlds, contacting agents, rejoining, the interactive mode and the shutdown.
connpool NodeConn The connection manager of a node. It owns the two network instances (public and world), the connection pools and the Sessions with the peers. The hosted entity sends and receives through it.
profile NodeProfile The profile of a node: the static part from the server, the dynamic part of the running process and the CV of badges. Nodes exchange profiles in the handshake.
tokens TokenVerifier The verification of the node tokens that peers attach to their messages and offer in the handshake.

The objects relate as follows. A Node builds its NodeProfile and its NodeConn in the constructor and hands both to the hosted entity. NodeConn builds a TokenVerifier from the public key that the server returned with the token of the node and uses it to check the token of every peer. The profiles of the peers that an agent knows are NodeProfile objects in agent.all_agents.

Importing the package imports the four modules. Application code imports Node directly:

from unaiverse.networking.node.node import Node

The concepts are in Nodes and Networking.