Skip to content

Instantly share code, notes, and snippets.

@dtinth
Last active January 19, 2026 13:43
Show Gist options
  • Select an option

  • Save dtinth/a781d6fee01707d067ca70ecb58966c1 to your computer and use it in GitHub Desktop.

Select an option

Save dtinth/a781d6fee01707d067ca70ecb58966c1 to your computer and use it in GitHub Desktop.
Example server-side script that can communicate with Patchies
import { RTCPeerConnection } from "werift";
import { joinRoom } from "trystero";
const appId = "patchies";
const roomId = "dc291c71-d2eb-464b-b464-b6e817a32dd7";
const room = joinRoom({ appId, rtcPolyfill: RTCPeerConnection }, roomId);
const [netsend, netrecv] = room.makeAction("1");
// To receive messages: netrecv(msg => { console.log(msg) });
// To send a message: netsend({ foo: "bar" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment