0.0.5 • Published 1 month ago

y-trystero v0.0.5

Weekly downloads
-
License
-
Repository
github
Last release
1 month ago

Y-Trystero

(Not affiliated with either Yjs or Trystero)

Use Trystero as the backend for Yjs! This allows for using decentralized signaling servers (currently Bittorrent, IPFS, Nostr, or MQTT) to sync Yjs documents.

Usage is similar to the WebRTC provider:

import * as Y from "yjs";
import { TrysteroProvider } from "y-trystero";

const ydoc = new Y.Doc();
const provider = new TrysteroProvider("your-room-name", ydoc, {
  password: "optional-password",
});

// use as normal
const yarray = ydoc.get("array", Y.Array);

The options support two additional optional fields:

  • joinRoom: an alternative Trystero joinRoom function (all 4 are reexported in the y-trystero package)
  • appId: passed through to Trystero
import { joinRoom } from "y-trystero/ipfs";

const provider = new TrysteroProvider("your-room-name", ydoc, {
  appId: "your-app-name", // optional, but recommended
  joinRoom: joinRoom,
});

TODO:

  • Tests
  • Demo
0.0.5

1 month ago

0.0.4

1 month ago

0.0.1

1 month ago

0.0.0

1 month ago