robopeer logo

Why?

👩🏾 Alice and 👨🏻‍🦲 Bob can connect via a relay for peer-to-peer communication when they are both online. The relay doesn't have any memory, though. So what happens if they're not online at the same time?

🤖 Robopeer is a peer, like Alice or Bob. But unlike Alice and Bob, Robopeer never goes offline.

Robopeer never contributes messages of its own; it only passes on messages it has received from human peers.

What?

Robopeer is a very small server that instantiates a peer-to-peer client on request, and connects it to a @localfirst/relay server.

On its own, Robopeer can't do anything: It needs to be paired with a peer-to-peer synchronization protocol.

You can choose from one of these implementations, or create your own.

How?

Creating a server

Server endpoints

Create a Robopeer

POST /create

accessKey required
The access key with which the server was instantiated.

documentId required
A unique identifier for the document or topic that this robopeer will use to connect to the relay. This can also be thought of as a "discovery key" or a "channel ID".

clientId required
A unique identifier for the Robopeer's client. Depending on the protocol you are using, this might be a username or a device ID that the other peers might recognize.

Your request body might also include parameters for the use of the specific protocol you are using. For example, the @localfirst/auth implementation requires an invitation code.

Destroy a Robopeer

POST /destroy

Storage

By default Robopeer keeps messages in memory and doesn't persist to storage.

To add persistence, you can use any one of these storage plugins, or fork one of these to create your own:

  • robopeer-storage-mongodb
  • robopeer-storage-redis
  • etc

Doodles