nimeshnayaju / y-presence

Simple react hooks to manage multiplayer presence using Yjs
MIT License
177 stars 4 forks source link

Can we implement using WebRTC? #2

Closed abhicoditation closed 1 year ago

abhicoditation commented 1 year ago

Hi, This may be a very silly and rookie question. Can we implement live cursors using WebRTC instead of WebSocket? I tried but looks like only local user state is set and tracked.

nimeshnayaju commented 1 year ago

All connection provider for Yjs should be supported. I've forked the WebSocketProvider demo and replaced it with WebRTC and works as expected. And, not a silly question at all, I've found myself feeling confused about similar things before. Cheers!

WebRTC Demo Link: https://codesandbox.io/s/y-presence-demo-live-cursors-forked-zicojw

nimeshnayaju commented 1 year ago

Were you able to run the demo? Let me know if the demo helped.

abhicoditation commented 1 year ago

Hi @nimeshnayaju , sorry for late response. Yes it helped. I was able to implement it. Thank you !

nimeshnayaju commented 1 year ago

Awesome. Good luck on your project!