Horusiath / yrs-webrtc

WebRTC network connector for Yjs/Yrs update gossips
Other
13 stars 0 forks source link

Use as client #7

Open eberberich opened 1 week ago

eberberich commented 1 week ago

In the examples/demo we can see rust code to become aware of changes (of the single doc the server maintains). However we are missing to see an example how to use the code using a rust client. Say we run a warp signaling server (ws, or webrtc) and have clients using WebRrtcProvider from JS y-webrtc, but ALSO a client - written in rust - that connects to a remote document (given a room name) and syncs automatically with the remote documents

A bit like the rust version of the follwing JS

const doc = new Y.Doc()
const provider = new WebrtcProvider('sample', doc, { signaling: ['ws://localhost:8000/signaling'] })
// now changes to doc from events etc .. and propagate them

In other words: How a rust client would look like?

Horusiath commented 1 week ago

You can see a Rust client (peer) code in the Example section of the readme file: https://github.com/Horusiath/yrs-webrtc/blob/a209523f06aa79c3c5a65c391a9ec2440f00dbc0/README.md?plain=1#L13-L41