www.webdeveloper.com
Results 1 to 7 of 7

Thread: Design pattern of chat

Threaded View

  1. #1
    Join Date
    Jun 2008
    Posts
    136

    Design pattern of chat

    Hi,

    I've written a chat using ajax. In a nutshell, every few seconds, an ajax call is fired and data is getting updated. The ajax function is a setTimeout in itself, so the loop goes on.

    What's bothering me is that, when a page is open on my computer, it will send requests forever. So if I reduce setTimeout time to have more live/instant experience, I'd be firing a lot of redundant requests because most of them aren't necessary. I'd like to know if there's a way to only send the request if there's an update on the server. So instead of sending ajax and wait for response, just "listen" for a response?

    Maybe I'm trying to ask if there's a way to have a response on a page without "requesting by ajax"?
    All alternative ways are welcome.

    Thanks for your time.
    Last edited by asmith20002; 03-02-2013 at 03:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles