1

There's data providers that offer you X ammount of websockets connections to get realtime data from them, I wanted to know if somehow there's a way to use nginx as a reverse-proxy in order to suscribe to that endpoint my data provider offers realtime data with websockets in order to act as a bridge to get realtime data through my reverse-proxy instead of going with them.

Basically suscribe to their websocket but with my reverse-proxy and offer my reverse-proxy as a websocket to ANY ammount of clients to bypass that limitation of my provider

Sorry I cant provide any example of this, I havent found anything like it on the web. Im still crawling it.

Napal
  • 113
  • 2

1 Answers1

1

Simple answer: no. (at least without modules)

NGINX can only forward requests and distribute to multiple backends but can not "subscribe" to a websocket and broadcast it to multiple subscribing clients.

You need an appserver for that which opens the websocket and handles the broadcasting to clients (which can come from NGINX).

unNamed
  • 624
  • 6
  • 16
  • That means I have to build a webapp that connects the "Bridge" Im talking about kind of like asynch socket requests from my webapp to the other socket end? – Napal Dec 16 '20 at 17:50
  • 1
    It should be more like an app server than a web app. The app server keeps a single connection open to retrieve the information. On the other side you can use nginx to deliver that local content from that app server. – unNamed Dec 16 '20 at 21:20