Closed hanspagel closed 3 years ago
I don't think this is possible atm as native websocket clients are not able to connect to socket.io servers and vice versa, thus y-websocket had to be rewritten using socket.io. (And most likely the complete core of hocuspocus too)
As most browsers (> 97%) support native websockets I don't think the huge amount of work is justified as people could always use the webhook-extension or their own implementation to integrate hocuspocus into their existing applications.
Instead of building anything, just providing documentation for how to use express / socketio / and the webhook-extension might be helpful. I'll try to get an example together and share it here when I have something working.
There is already a lot of documentation. Let us know if you miss anything:
The y-websocket client used to have support for Socket.io: https://gist.github.com/dmonad/acd89745de1115cf712b35dcacd15cda
I’ll need to find out why it’s not in the client anymore. But from everything I know, I have to agree with @kriskbx: I don’t think it makes sense to build out Socket.io support (extending the server AND creating a new client) in the current stage.
The reason why I switched from socket.io to pure Websockets is that the dependency load of socket.io is immense. It incurs extra overhead in every step without adding anything relevant to realtime applications. Any of the fallback solutions (HTTP long pulling, flash sockets (Adobe Flash), server sent events, ..) are not suitable for modern shared editing applications. We can do much better with pure Websockets which are supported in every browser since 2012. As @kriskbx mentioned, it should be possible to implement y-websocket backends in different programming languages. The socket.io protocol is pretty complex and it will take extra effort to port that to another language.
Hi guys! I'm using socket.io in my project for chat and want to use hocuspocus for collaboration. Is there a way to combine this?
Unfortunately not!
Oh, maybe you know of an alternative library instead of socket.io that I can use for chat and that will work with hocuspocus?
You can always use difference endpoint for socket.io and plain websocket to make them work together.
For people using Socket.io it would be great to integrate hocuspocus, like it’s already possible with Express.