tags:

views:

45

answers:

2

I'm not sure if this is possibly, I may end up having to change how I'm doing this.

I have an Android app that's mostly just a webview that displays the mobile version of a site, which is in .NET. The chat room uses jQuery and updates every 1.5 seconds using ajax. The box you type in though is part of the Android app though. When you submit a message it's sent to a REST page and then added to the messages list. The users session is on the chat page, not on the REST page.

Because of the 1.5 second delay between refreshes it can make the chat seem laggy. I'd like to somehow trigger an event to immediately update the messages for that user. I'm wondering if this can be done using jQuery or javascript.

Has any done something like that, or know how this can be done?

A: 

I have not tested "comet and jquery" but it worked for somebody.

About Comet(Programming)

Reigel
A: 

I've been pondering about the exact same question for some time. I've never actually implemented anything for my own application but I can point you in the right direction.

What you are looking for, especially for chat web apps, is long-polling or try googling for cometd. Even better if you are developing using HTML5 technologies, Web Sockets is the right thing to use for this scenario. Web sockets help reduce the number of times your app contacts the server hence, making your application much speedier.

Sorry I don't have any code examples. Above are just my $0.02

Mark