Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket.io support #95

Closed
hanspagel opened this issue May 11, 2021 · 9 comments
Closed

Socket.io support #95

hanspagel opened this issue May 11, 2021 · 9 comments

Comments

@hanspagel
Copy link
Contributor

For people using Socket.io it would be great to integrate hocuspocus, like it’s already possible with Express.

@kriskbx
Copy link
Collaborator

kriskbx commented May 11, 2021

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.

@jperl
Copy link

jperl commented May 12, 2021

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.

@kriskbx
Copy link
Collaborator

kriskbx commented May 14, 2021

There is already a lot of documentation. Let us know if you miss anything:

@hanspagel
Copy link
Contributor Author

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.

@dmonad
Copy link
Collaborator

dmonad commented May 20, 2021

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.

@DenysPoliarush
Copy link
Collaborator

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?

@hanspagel
Copy link
Contributor Author

Unfortunately not!

@DenysPoliarush
Copy link
Collaborator

Oh, maybe you know of an alternative library instead of socket.io that I can use for chat and that will work with hocuspocus?

@DanSnow
Copy link
Collaborator

DanSnow commented Jul 14, 2021

You can always use difference endpoint for socket.io and plain websocket to make them work together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants