SSyncropel Docs

Async federation: pairing across offline peers

Use a relay so instances that are rarely online together can still share records. Covers what the relay protects, what it can see, and how it works alongside direct federation.

Who this is for

You have two Syncropel instances that are rarely online at the same time, such as a laptop and a phone, two teammates in different time zones, or a hosted instance and a home server that sleeps overnight. Direct federation needs both to be reachable at the same time. A relay holds records for you until the other side comes online.

If your instances are always on and can reach each other, use direct federation. It is simpler. This guide is for when they can't.

What async federation unlocks

A relay is a simple mailbox addressed by the receiver's DID (its identity). Senders drop off envelopes (signed bundles of records). Receivers collect them when they come online. The relay does not check signatures; the receiver does. It cannot read records inside encrypted envelopes.

This means:

  • Laptops and phones can take part. The relay keeps envelopes for up to 30 days, so closing your lid loses nothing.
  • No scheduling. Sender and receiver never need to be online together.
  • No public address needed. Both sides connect out to the relay, and neither accepts incoming connections.
  • Direct delivery still works. Senders try a direct connection first. The relay is the backup.

Setup

Pick a relay

A free public relay is available at https://relay.syncropel.com. Use it for experimentation, personal federation, or small community use. For full control or higher volume, run your own.

Configure it on the receiving side

The receiver needs to know which relay to poll. Write the URL as a catch-all:

spl config relay set https://relay.syncropel.com --for-pair all

--for-pair lets you scope relays per sender DID if you want different relays for different peers. all is the catch-all used when no peer-specific relay is configured:

# Catch-all for any peer
spl config relay set https://relay.syncropel.com --for-pair all

# Override for one specific peer
spl config relay set https://private-relay.example.com --for-pair did:sync:user:alice

After you set a relay, restart spl serve so it starts collecting from it.

spl stop
spl serve

Inspect configured relays

spl config relay show
# catch-all: https://relay.syncropel.com (enabled)
# did:sync:user:alice: https://private-relay.example.com (enabled)

Verify the relay is reachable

spl config relay status
# relay.syncropel.com → /health 200 ok (12ms)

If this fails, you won't receive anything. Fix connectivity before troubleshooting elsewhere.

Clear an entry

spl config relay clear --for-pair did:sync:user:alice

How it works end-to-end

  1. The sender writes a record on a thread that is shared with the peer through the relay.
  2. The sender's instance packs an envelope, signs it with the sender's key, addresses it to the receiver's DID, and tries a direct connection first.
  3. If that fails (receiver offline, no route, timeout), the sender drops the envelope at the relay with POST /v1/mailbox/<receiver-did>.
  4. The relay holds the envelope under the receiver's DID and answers 202 Accepted.
  5. The receiver collects with GET /v1/mailbox/<receiver-did>/receive.
  6. The receiver checks the signatures, saves the records, and sends POST /v1/mailbox/<receiver-did>/ack so the relay removes them.
  7. The records appear in the receiver's threads like any other shared records.

Receiving the same envelope twice is harmless. If the receiver never acknowledges, the envelope still expires from the relay after 30 days.

What the relay protects

  • Authenticity: envelopes are signed by the sender. A tampered or forged envelope fails the check at the receiver and is dropped.
  • Integrity: a changed record no longer matches its ID, and the receiver detects it.
  • Replay: sending the same envelope again has no extra effect.

What the relay does not protect

  • Sender/receiver metadata: the relay sees which DID is talking to which. If that pairing alone is sensitive, use a relay operator you trust, or run your own.
  • Envelope sizes and timing: visible to the operator even when contents are encrypted.
  • Record contents when encoding: plain: cleartext envelopes let a curious operator read your records.

The relay does not vouch for anyone's identity. If it disappeared, your records would still be yours: senders keep local copies, and direct delivery works without it.

Cost

relay.syncropel.com is free. It needs no signup or API key. The only limits are 10,000 queued envelopes per receiver and a 30-day expiry per envelope. You only reach them if a receiver stays offline for a very long time.

Pair with synchronous federation

A relay does not replace direct federation. The sender tries a direct connection first and uses the relay if that fails:

emit record
    │
    ▼
try direct (peer_url/v1/sync/records)
    ├── success → done, no relay involvement
    └── failure → deposit via configured relay

This means:

  • Both peers online → direct HTTP, relay untouched, minimum latency.
  • Only sender online → relay absorbs the envelope, receiver picks it up later.
  • Only receiver online → receiver checks the relay, finds nothing yet, and waits.
  • Neither online → sender keeps the records locally and sends them when it is next online.

You don't have to choose. Set up both a federation pair and a relay, and the instance uses whichever works.

Troubleshooting

I configured a relay but nothing is arriving

  1. spl config relay show: is the URL what you expect? Catch-all vs peer-specific scoping matters.
  2. spl config relay status: does /health respond?
  3. Did you restart spl serve after setting the relay? It only starts collecting at startup.
  4. From the sender side: spl fleet sync status. Does it show the relay as the delivery path? If it's still trying direct and failing, check whether the peer's federation URL is correct on the sender.

Envelopes keep redelivering (appearing again after I thought I acked them)

The receiver acknowledges after it saves the records. If it stops between receiving and acknowledging, the next check collects them again. This is safe: no duplicate records are saved.

If envelopes keep coming back without any crash, the acknowledgement is failing. Check the network between the receiver and the relay. Receiving works but acknowledging fails when the network is flaky or a proxy times out on the POST.

I see a big backlog on spl config relay status

The relay's /metrics endpoint (if you're operating the relay or have read access) exposes relay_queue_size{did="<your-did>"}. If that keeps climbing, your instance isn't collecting fast enough. Run spl doctor, which flags stalled federation.

I want to delete a relay-configured peer

spl config relay clear --for-pair <did> disables the entry. Restart spl serve to stop collecting for that peer right away.

See also

On this page