We have a web application that currently uses polling to handle continuous updates.
While switching to long polling may be a small bandaid to the issue, we wanted to implement a Websockets solution that will be durable and scalable.
My question is: what kind of architecture will be needed for this?
I have done some research myself and have found that the typical setup for an enterprise application is something like this: 
The execution flow of a connection then would be something like this:
HTTP Request to Server along with JS to request a Websocket connectionServer responds, Header contains the Upgrade directive and switches protocols for that clientWebsocket connection with clientPOST/PUT/etc.
Webserver (Apache/Nginx) fetches result from queryWebserver sends result to the MQ where it is added to the queueMessage is sent to Websocket server from MQ
Message is sent back to the clientIs this approach correct? Am I missing anything? Am I understanding something incorrectly?
Try having a look at this: socketo.me
Kinda gives you an idea. From what I can see, this is fairly similar to what you've envisioned in the architecture diagram you posted.
May also be worth looking at this Stackoverflow question's answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With