virrion
virrion

Reputation: 424

Implementing notifications to web app without using Ajax calls to server or so

Case scenario: I have few 2k concurrent users access to the website with various devices but using their browsers. Once one of them create new topic, all others currently connected should receive a notification (basically I simple update little icon number in app upper right corner).

One way to accomplish this is to have web app keep requesting updates via ajax calls but that overload my slow server with numerous requests.

I use azure to host my web app (written in PHP). There are some services included in my hosting package such as Event Hub, Service Bus etc. What service could I use in order to have my backed talk to a "service" whenever there is a new post, and than to have that "service" talk to my clients (their browsers) and informing them about new notification or any type of data updates?

Upvotes: 2

Views: 213

Answers (1)

Johannes Müller
Johannes Müller

Reputation: 5661

You're probably looking for websockets. A websocket sets up a connection between the page in the client's browser and your webserver. Through this connection you can push new topics to all connected clients.

It is advisable to decouple the websocket sending process from the request handling of the topic creation. For this you need a background worker which sends websocket notifications when triggered from a processing event.

You can implement this in PHP using ratchet.

Upvotes: 1

Related Questions