How to create a real-time notification system similar to Stack Overflow?

Asked

Viewed 10,218 times

29

I am developing a Help Desk system, and would like some ideas on how to create a notification system similar to Stack Overflow itself, whenever some new support is registered.

I intend to use PHP, Mysql and jQuery only.

Should I use the window.setTimeout to check in the bank from time to time if a new call is registered?

  • 4

    Stack Overflow uses websockets for real-time notifications.

  • Did any of the answers help you? Or are there problems with them? Comment informing the author who doubts to try to use the proposed solution. If any of the answers solved your problem, mark it as correct by clicking on

3 answers

17

I just answered a similar question, only I was talking about a chat.

The options you have are as follows::

To implement the chat:

  • the option that will give you the widest range in terms of browsers, is called long-time, but it is also the one that will give more work. See more about the technique: long-time
  • another option that will be easier, is to use websocket, and create a server connection, which will be able to send messages when some chat event occurs... type send a message, but in that case the server will need to be able to receive the client connection via websocket (will have to be able to wait for connections... just search for "php websocket" on google that appear some libraries).

13

Dude, NAY use ajax with setInterval. See, imagine that every 1 minute the system will make a request to the server and return a response to the browser, even if there are no changes in the conversation. If there are multiple clients, it will overload the system with ajax requests, which would be a waste of resources.

Look for PHP+LONG POLLING. Long Polling works different from ajax, the connection is open waiting for a response from the server.

The same ideal would be to implement this part in nodejs, since it is more suitable for real time applications.

1

Have you ever thought of using some kind of Pusher notification system like for example the Pusher or the PubNub ?

You use timeout you’ll be doing Long Polling and this type of update uses much more feature.

My suggestion to you would be you take a look at the best option:

  • what do the Pusher and the PubNub exactly?

  • 1

    The two provide a Websocket-based push notification service. The advantage of using these two is that they various types of API for integration into your system. The basis is that you will create a channel and when that channel is invoked it will run an Handler.

  • Example: http://pubnub.github.io/backbone/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.