After spending few hours on the internet to find about push notification system for web application, I have some conclusion and also curiosity about it..
When we’re looking for this notification technology, we will see ‘websocket’ terms over and over again. specially in this HTML 5 era.
But, after seeing this demo : http://www.websocket.org/echo.html
One thing I just realized is : websocket will push notification FROM a browser TO another browser. There’s no database involved here.
What if, in my case, I have a database regularly inserted by Linux Daemon (not a web browser) but I want it to be pushed to client’s web browser? how to do that with websocket? or this is the limitation of websocket technology? if so, is there any solution for my case?
thanks.
It depends on the server you are using to handle the websocket requests. You will need to develop the server to check for/push database updates to the client.
What if, in my case, I have a database regularly inserted by Linux Daemon (not a web browser) but I want it to be pushed to client's web browser? how to do that with websocket?You don’t do this with websockets; javascript websockets are the client-side implementations. You will need to handle this on your server (maybe make the insertion daemon send a signal to the server application, or have the server code regularly check for updates to the database).
You may want to play aroud with mod_pywebsocket to give you ideas. Also see Why do we need web-sockets? to help you understand what websockets really are.
Websockets are just open connections to the server. It’s kinda like calling someone and having them say “please hold”. The connection is open, but once they have something to talk to you about, rather than having to dial your phone and then wait for you to answer, they just lift up the receiver and start talking. So it is with websockets; once the server has data ready, I just sends it to the client (or vice-versa). This avoids having to make numerous AJAX calls to the server.
So websockets can do anything; the limitation is not the connection, but how well you program the client and server.