Y-websocket provider & Rails ActionCable

Hello! I’m exploring this library and was wondering if you have any suggestions for porting over y-websocket to work nicely with ActionCable, or if there’s any other implementations with something like anycable that I could look towards?

thanks!

Hi @dennyluan, I don’t plan to write a ActionCable module. But it should be pretty easy to build a simple broadcast module that broadcasts all updates using ActionCable. It would work similarly to the broadcastchannel protocol that I implemented in y-webrtc and y-websocket.

Here is the documentation on how document updates are encoded: https://github.com/yjs/yjs#Document-Updates

The idea would be to broadcast all document updates. You also need to request the current state of the document from all peers before you can start a new session. You could define this as a separate message type. Because there is no clear “leader” that own the data, you’d simply broadcast the current state of the document when a remote client requests it.