user4671628
user4671628

Reputation:

Implementing Real Time application using Redis and Faye

I need to develop a realtime notification system. Load won't be high, about a dozen of events per hour. But I just want to make it scalable for future development.

My application is written entirely in PHP.

I have found different ways of implementing real-time applications. And I think the following architecture is quite simple and have a lot of benefits.

Real Time Ruby Architecture

But I want to use the Faye library for implementing real time notifications, because it has fallbacks, and generally I am not going to use Websockets because my load is really low, and at first I will stick to the long-polling mechanism. Faye provides a convenient way for disabling and enabling different transport protocols.

Here is how my architecture is going to look

enter image description here

However I have one question regarding communicating back from a client.

Consider the following case.

  1. Client loads a page through plain old HTTP request to a PHP app
  2. Client side script opens a websocket/long polling connection
  3. Another person sends notification via posting it through a simple AJAX request
  4. This notification is saved to a database and assigned to a target recipient.
  5. Notification is posted to a Redis database and consumed by Faye
  6. Notification is sent to a client, everything is fine.

So far so good, but I need to some sort of back communication, for example when a client dismisses an event. How should this be implemented, should I send this action back using Faye or this should be sent directly to the PHP application. In case of sending an event back using Faye I need to notify my PHP application that an event was seen and dismissed. Of course I can use the same database from a Ruby application as used by PHP app, but this makes these two application coupled.

Could you suggest a right way to implement this ?

Upvotes: 0

Views: 224

Answers (0)

Related Questions