Connection Flow - AtlasNet/Protocols GitHub Wiki
Connection flow between two Nodes
The TCP client node is the Calling node, the TCP server node is the Serving node. See Node Protocol.
Starting the connection
- The calling node invokes ping() to ensure that serving node is usable.
- Calling node supplies its information through hello() method.
Joining the network
- Calling node invokes join(). The serving node then contacts all known nodes and calls registerNode(callingNodeInfo, servingNodeInfo) to notify them of a new network member.
- Calling node invokes getKnownNodes() to receive the list of currently known network members.
Message listing registration
- Calling node invokes registerMessageListing(recipientKey, messageId) to notify the serving node of a new message being stored on the calling node.
Message listing unregistration
- Calling node invokes unregisterMessageListing(messageId) to notify the serving node of a message being deleted or expired on the calling node.
Closing the connection
No extra method calls are required before closing the connection.
Connection flow between a client and a node
Starting the connection
- The client invokes ping() to ensure that node is usable.
- Client invokes getKnownNodes() to receive the list of currently known network members.
Posting a message
- Client invokes postMessage(message). Node stores the message block in its database.
- Node uses registerMessageListing(recipientKey, messageId) call to notify each known node of a new message listing.
Retrieving message listings
- Client performs an Authentication sequence.
- Client calls getListings() to get listings of all pending messages.
Retrieving enlisted messages
- Client connects to each node holding one of the listed messages. See Starting the connection.
- Client performs an Authentication sequence.
- Client calls hasMessage(id) to ensure that message is still present on the node.
- Client calls retrieveMessage(id) to retrieve the message block.
- Node erases the message from its storage.
- Node uses unregisterMessageListing(messageId) call to notify each known node of a the message being removed from the network.
Closing the connection
No extra method calls are required before closing the connection.