pnxtech/hydra

Proxying socket.io connection

Closed this issue · 3 comments

Hello everyone,
I am looking for some advice on how to best handle proxying of socket connections. I am using the API Gateway pattern to expose a single point of entry. REST requests are forwarded using hydra.makeAPIRequest() and they call appropriate services.

I am struggling a bit with how to handle Socket.io connections, not to expose our Notification Service directly. There are some packages (socket.io-proxy) that offer this functionality but they require direct addressing while hydra operates on dynamic ports and instances.

What are your thoughts on the issue? How to best handle this case?

cjus commented

@alvarg93 Have you considered using HydraRouter which already has support for websocket message routing to microservices? In Hydra-router an incoming websocket call can be translated (automatically) to a REST call. https://www.hydramicroservice.com/docs/tools/hydra-router/

I'll take a look, thanks 🙂

cjus commented

@alvarg93 let us know if you have further questions. Please close this ticket if not. ;-)