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

  1. The calling node invokes ping() to ensure that serving node is usable.
  2. Calling node supplies its information through hello() method.

Joining the network

  1. 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.
  2. Calling node invokes getKnownNodes() to receive the list of currently known network members.

Message listing registration

  1. Calling node invokes registerMessageListing(recipientKey, messageId) to notify the serving node of a new message being stored on the calling node.

Message listing unregistration

  1. 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

  1. The client invokes ping() to ensure that node is usable.
  2. Client invokes getKnownNodes() to receive the list of currently known network members.

Posting a message

  1. Client invokes postMessage(message). Node stores the message block in its database.
  2. Node uses registerMessageListing(recipientKey, messageId) call to notify each known node of a new message listing.

Retrieving message listings

  1. Client performs an Authentication sequence.
  2. Client calls getListings() to get listings of all pending messages.

Retrieving enlisted messages

  1. Client connects to each node holding one of the listed messages. See Starting the connection.
  2. Client performs an Authentication sequence.
  3. Client calls hasMessage(id) to ensure that message is still present on the node.
  4. Client calls retrieveMessage(id) to retrieve the message block.
  5. Node erases the message from its storage.
  6. 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.