10

I am developing a web app in which I want that when some changes in database occurs, server sends response to particular client(like push notification). And I want this notification to be sent client's browser. I don't want to use polling.

What can I do? I think it's possible using SSE, but I am not clear.
I want to know

  • Is it possible to send response to particular client without client's request(without polling).
  • How server will detect that particular client?

please help me.

peterh
  • 1
  • 15
  • 76
  • 99
Rikin Thakkar
  • 1,268
  • 3
  • 13
  • 27

1 Answers1

5

There is Web Notification. And there you can see the browsers that support it.

Gros Lalo
  • 1,038
  • 7
  • 18
  • hey u know what i want actualy..? I want that types of news updates like facebook gives at the top-right side of the page.. Any idea how to do this without using polling..? – Rikin Thakkar Sep 11 '12 at 11:26
  • Well if you have a webserver and you want the notifications to come through while the app/site is running in your browser then you can use WebSocket. WebSocket does not require polling. So, when there is data available or, a change that you want to communicate to the connected browsers you can then push them. Do you know about WebSockets? – Gros Lalo Sep 11 '12 at 11:33
  • yaaa.. i know websockets but i want to know which is best option in my case websockets or SSE..? – Rikin Thakkar Sep 11 '12 at 12:06
  • It is hard to tell as your case it quite limited. If it is only about receiving notifications then both are equally valid in my opinion. I do not know much about the server side implementation for SSE but for web-socket it is quite easy even if you are building things from scratch. Also, if your case evolves then you should consider constraints such as, SSE is uni-directional while with web-sockets it is bi-directional. So, it depends as you can see. – Gros Lalo Sep 11 '12 at 13:40
  • No worries. Somehow i feel i did not do much to help :) – Gros Lalo Sep 12 '12 at 08:47
  • Mmmm, isn't Web Notifications for showing a popup outside of the browser? Can you give a working example of server to browser data push? – Ciro Santilli Путлер Капут 六四事 Dec 10 '14 at 15:40