2

I want to implement real time notifications like in Facebook. There might be a huge number of notifications to be sent for different users, depending on server load time and efficiency of coding. Which is the best approach?

 1. using normal AJAX?
 2. with node.js and socket programming?
 3. something else?

Thanks in advance.

Julie Pelletier
  • 1,740
  • 1
  • 10
  • 18
Manohar Khadka
  • 2,186
  • 2
  • 18
  • 30

3 Answers3

4

The choice of the proper platform greatly depends on your current architecture, knowledge, and budget.

Your question suggests that it is web based, for which there are only two basic options:

  • WebSocket: There exists many WebSocket server solutions including compiled executables, PHP based, and Node.js. This approach is greatly gaining in popularity but isn't necessarily accessible to every budget since it usually requires a complete server to run. VPS limitations are usually too important for systems that require so many simultaneous connections.
  • AJAX: The use of AJAX and its variants is still a very popular solution and, when well implemented, can be almost as efficient as WebSocket without the need to sustain the connections constantly. It doesn't often matter if there is a one second delay, and Facebook chat is usually much slower than that.

For non web-based solution, anything is possible. If you develop a client-server application, you can have real time connections similar to WebSocket which can be even easier to maintain.

Julie Pelletier
  • 1,740
  • 1
  • 10
  • 18
0

Ajax request not real time but you can set timeout and in this case work. but the ajax request busy your server and try to many connections. this is simple !

If you use socket it's better but you need more time to develop this.

Read the following link can help you :

Ajax vs Socket.io

Community
  • 1
  • 1
Amir Mohsen
  • 853
  • 2
  • 9
  • 23
0

Nowadays we have two possible solutions. WebSockets and Comet. WebSockets are probably the best solution but they’ve got two mayor problems:

Not all browsers support them.
Not all proxy servers allows the communications with websokets.

Because of that I prefer to use comet (at least now). It’s not as good as websockets but pretty straightforward ant it works (even on IE). realtimenotifications more details To know more about refer above link.

Dipika
  • 115
  • 1
  • 3
  • 15