aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to notify a client without polling? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to notify a client without polling?" Watch "How to notify a client without polling?" New topic
Author

How to notify a client without polling?

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi all, I don't know whether this is the right forum to post this question. My apologizes.

The requirement is I want to notify a client that some data has been changed on the server. HTTP is stateless. I don't want to poll the server using ajax calls.

Is there any way to notify the client?

Thank you all in advance. Good day.


Love all, trust a few, do wrong to none.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

The only other options are to use an applet or other technology such as Comet, which maintains an open connection. This is terribly expensive and is not recommended for general use.

I'm always suspicious when someone posts "I don't want to use whatever" without explaining why. So, why do you not want to use polling?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Bear Bibeault wrote:I'm always suspicious when someone posts "I don't want to use whatever" without explaining why. So, why do you not want to use polling?

The only reason I said I don't want to use polling is, when I ask this question people generally say to opt for polling mechanism. I know about polling and want to know whether there is any other alternative. To just make sure not to get answers related to polling I mentioned I wont want to go with polling.

Another thing I want to know is how to yahoo, facbook, gmail etc implement chat modules in a web page? Do they maintain push chat servers or the chat servers are polled every moment?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

chaitanya karthikk wrote:
Bear Bibeault wrote:I'm always suspicious when someone posts "I don't want to use whatever" without explaining why. So, why do you not want to use polling?

The only reason I said I don't want to use polling is, when I ask this question people generally say to opt for polling mechanism. I know about polling and want to know whether there is any other alternative. To just make sure not to get answers related to polling I mentioned I wont want to go with polling.

Then you should say that. otherwise, you just look clueless.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Bear Bibeault wrote:Then you should say that. otherwise, you just look clueless.
Sure Bear.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
chaitanya karthikk wrote:Another thing I want to know is how to yahoo, facbook, gmail etc implement chat modules in a web page? Do they maintain push chat servers or the chat servers are polled every moment?


Open up a tool like Fiddler or Charles and watch the HTTP traffic to see what they do.

Modern day browsers do support sockets.

Eric
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Eric Pascarello wrote:
Open up a tool like Fiddler or Charles and watch the HTTP traffic to see what they do.

Modern day browsers do support sockets.

Eric


Thank you Eric. I would like to know is there any documentation on how to open sockets from my browser to a server?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I bet google could answer that.

MDN JavaScript Sockets
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Thank you, I'll look at it.
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

chaitanya karthikk wrote:Hi all, I don't know whether this is the right forum to post this question. My apologizes.

The requirement is I want to notify a client that some data has been changed on the server. HTTP is stateless. I don't want to poll the server using ajax calls.

Is there any way to notify the client?

Thank you all in advance. Good day.



i think you can also use MQTT protocol, which is the publisher, subscriber protocol. we had used in our project to send push notifications for android. but it has been applied in varied scenarios.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to notify a client without polling?