reconnect after lost connection (googletalk style?)

J

joes.mailing.lists

Hi,
I'm working a web application using comet (Orbited) for real-time
status updates and messaging. The messaging system works great, but
I've noticed that if I disconnect my laptop internet connection, and
then reconnect it the messaging does not reload with the connection.

It seems that gmail/googletalk implement a feature whereby the chat
section attempts to reconnect every 60s or so even when the internet
connection is down. When the connection comes back up it then
automatically reconnects.

Is there an simple, concise way of implementing this sort of
reconnection in client-side javascript? Is gmail/googletalk even
accomplishing this via javascript? Do I perhaps only need to set a
simple timed refresh?

I spent a bit of time searching this list and google/yahoo for
things like "javascript refresh lost connection" but wasn't able to
come up with much.

Cheers
 
G

GArlington

Hi,
I'm working a web application using comet (Orbited) for real-time
status updates and messaging. The messaging system works great, but
I've noticed that if I disconnect my laptop internet connection, and
then reconnect it the messaging does not reload with the connection.

It seems that gmail/googletalk implement a feature whereby the chat
section attempts to reconnect every 60s or so even when the internet
connection is down. When the connection comes back up it then
automatically reconnects.

Is there an simple, concise way of implementing this sort of
reconnection in client-side javascript? Is gmail/googletalk even
accomplishing this via javascript? Do I perhaps only need to set a
simple timed refresh?

I spent a bit of time searching this list and google/yahoo for
things like "javascript refresh lost connection" but wasn't able to
come up with much.

Cheers

You might want to search for something like "check network connection"
or "ping"...
You can use Ajax calls to check the connection status periodically.
 
D

david.karr

  It seems that gmail/googletalk implement a feature whereby the chat
section attempts to reconnect every 60s or so even when the internet
connection is down.  When the connection comes back up it then
automatically reconnects.

  Is there an simple, concise way of implementing this sort of
reconnection in client-side javascript?  Is gmail/googletalk even
accomplishing this via javascript?  Do I perhaps only need to set a
simple timed refresh?

You don't refresh the entire page, you just use "setTimeout" to call a
JavaScript function that initiates an Ajax call to do something useful.
 
B

beegee

You don't refresh the entire page, you just use "setTimeout" to call a
JavaScript function that initiates an Ajax call to do something useful.

Definitely use setTimeout but rather than the standard httpRequest
object, the OP should use the Orbited library call Orbited.connect().
I'm interested in comet so I looked up the docs on this daemon. Seems
okay but 1) there hasn't been a release in over a year (not a good
sign) and 2) the project is server-side centric to the point that
there is absolutely no javascript documentation on the site. If you
look on the little google group there are a few posts about
javascript.

I think the idea of a web server plugin to implement comet is a great
idea, I just hope the OP is a python expert because it looks like he
is now in charge.

Bob
 

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top