Last active
January 19, 2026 13:43
-
-
Save dtinth/a781d6fee01707d067ca70ecb58966c1 to your computer and use it in GitHub Desktop.
Example server-side script that can communicate with Patchies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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