JosiasAurel / y-webrtc

WebRTC Connector for Yjs running as a Peer on node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yjs webrtc on nodejs

This project is a demo running a yjs webrtc peer on nodejs via Docker using node-webrtc.

Setting up

  • Make sure you have Docker installed on your computer
  • Clone the repository and build the docker container by running
docker build --platform linux/amd64 -t yjswebrtc-node .

Replace yjswebrtc-node with any name of your choosing.

  • Then run the docker container using
docker run --platform linux/amd64 -it yjswebrtc-node

Again, replacing yjswebrtc-node with the name you chosed previously.

You should get an output such as

Listening on port 3000
synced! { synced: true }
yText 

... then the app is working properly!

Shenanigans

y-webrtc relies on the websockets module in lib0 module which itself depends on WebSocket support. However, Node does not natively support WebSocket so I ended up publishing a separate version of the module lib0-server-ws which includes WebSocket from ws.

About

WebRTC Connector for Yjs running as a Peer on node.js

License:MIT License


Languages

Language:JavaScript 97.4%Language:Dockerfile 2.6%