Click here to Skip to main content
15,910,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one!

i am doing a project regards to Webmail. I want server to send notification to client when new mail incomes rather than client request to server every minute.

Is it possible that Server could send notification to client?
If possible, please give me some advise.

I am using PHP as server-side and jQuery as client-side.

Thanks
Posted

This is called Push Technology. Here is the overview: http://en.wikipedia.org/wiki/Push_technology[^].

You can go to "See also" section and get information on available protocols and implementations.

—SA
 
Share this answer
 
v2
Comments
Bun Leap_kh 26-Oct-11 0:02am    
thanks, i'll try it.
In general no it is not possible. After the response is served to the client the server has no idea whether it still exists. The connection could be closed, the user navigated to another site or page, or the user could have gone to lunch. The only way would be to maintain an open connection between the server and client. Not possible or even a good idea for a web application.
 
Share this answer
 
Comments
Bun Leap_kh 25-Oct-11 23:09pm    
Excuse me, what do you mean by "The only way would be to maintain an open connection between the server and client."
and I wonder how GMail knows new mail incomes very fast.
Thanks
[no name] 26-Oct-11 0:05am    
Without knowing specifically I would guess they are using polling. Though they may appear to be fast the updates are not immediate.
Sergey Alexandrovich Kryukov 25-Oct-11 23:34pm    
I would not be so sure. Look at the "Push technology" article I referenced -- several approaches exist.
Not good idea? Not so simple. To me, domination of pull technology is bad idea. I vote for inversion of control.
--SA
[no name] 26-Oct-11 0:04am    
Yes, the connection between client and server remains open. Given that a lot of access is now via mobile devices it is not a good idea to keep that connection open using bandwidth and data time. Nor is it reliable as a connection can be broken at any time, mobile or desktop.
Sergey Alexandrovich Kryukov 26-Oct-11 11:51am    
You are right; but at the same time, the real demand for push technology is high. I think the problem you rightfully point out could be solved by re-connecting from the client side when a loss of connection is detected and the client as in "subscribed mode" before loss of connection. This is not easy though, before a client might need to re-subscribe, and the problem is persisting of client identity; in special case, this is not a problem if a client is authenticated, more difficult if not...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900