Skip to content

kahnpoint/y-trystero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Y-Trystero

(Not affiliated with either Yjs or Trystero)

⚠️ Early Development, Untested ⚠️

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

Installation

npm install y-trystero

Usage

Usage is nearly identical to the WebRTC provider, which it is based on:

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);

However, the options support two additional fields:

  • joinRoom: an alternative Trystero joinRoom function (all 4 are reexported in the y-trystero package)
  • appId: the application's name, passed through to the Trystero joinRoom function
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

About

Unofficial Yjs Trystero Provider

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published