It is possible to use socket.io and ws together?

782 Views Asked by At

I have a NestJS microservice using socket.io, but I need to know if it's possible to implement it in the same gateway WebSockets (WS). I need to send some requests at the same namespace from different clients (socket.io and ws). The actual implementation works only with socket.io.

2

There are 2 best solutions below

0
On

No, it is not possible according to the developers at socket.io. Here: https://socket.io/docs/#What-Socket-IO-is-not

0
On

Socket.IO uses Websockets but it is doing much more than it appears on first glance. You should see it as a different protocol.

Maybe you have a chance with a workaround but it will probably get messy. I found something here that might help.