The Synapse peripheral was built as a simple test of the Spider platform. It is a strong test since it must send messages not just between the peripheral and the base, but also from the base to a peer. It also requires all the mechanics needed to establish a connection with a peer.
When building the first version, it became clear that peripherals would need a way to know what peers were available. This led to the creation of the directory system. The directory is a dictionary of all the ids known to the base, as well as their relation to the base. Subscribing to the directory allows a peripheral to list the known peers. Synapse uses this list to let the user choose which conversation to open.
This leads directly to the next issue, which is how to initiate a connection with some new peer. The early versions did not handle this well. There was a text entry box to allow the user to input an id, which was awkward since the ids are long. This also couldn’t help the system actually establish a connection, since no ip address was included. The idea was that each base would already be configured to be connected to the same chord and the id would be a valid address in that chord.
Newer versions have replaced this with the invite system which includes the id as well as some connection information to help the base use the correct connection provider. The invite also contains a permission code to make accepting the connection smoother. The invite system mainly operates through the GUI. This has the advantage that no other peripheral needs to worry about implementing the invite mechanism in their own UI. It also allows the GUI to share the invite code in other ways, like by generating or scanning a QR code.
Once a conversation is selected, Synapse uses the dataset feature of the base to store sent and received messages. This takes advantage of the UI’s ability to generate UI elements based on the contents of a dataset. However, this needs work. At the moment, the UI does not expose a way of requesting parts of a dataset on demand. Instead the whole dataset is sent to the GUI to render. Chat applications typically will only load the most recent N messages, and only load earlier ones if the user scrolls back far enough. When the base supports these UI features, Synapse will be updated as well.