Note that there are some explanatory texts on larger screens.

plurals
  1. POout of this world Comet programming and a web-based chat
    primarykey
    data
    text
    <h2>Current Project Setup</h2> <p>I've been working on a web-based chat, similar to Facebook chat. At the current state, I listen for incoming chats and check for new messages in an existing chat is by doing...</p> <pre><code>setTimeout(function() { listenForIncomingChat() }, 500); setTimeout(function() { checkForIncomingMessages( ...params... ) }, 500); </code></pre> <p>... so doing the <code>setTimeout()</code> makes sure these functions are always running. Depending on how many chat windows I have open, Firebug's console can go crazy with <code>POST</code>s to the server :)</p> <p>Obviously this is really inefficient, but it is the only way I could get things to work. Now I'm looking for the ways to make it better, to do it correctly!</p> <h2>Some Research</h2> <p>Now, I have heard about <a href="http://en.wikipedia.org/wiki/Comet_%28programming%29" rel="nofollow noreferrer">Comet Programming</a> and that this is the way to open a long-lived HTTP connection with the server, but I'm not familiar with the technology or the ideas behind Comet. <a href="http://en.wikipedia.org/wiki/Web_Sockets" rel="nofollow noreferrer">WebSockets</a> for HTML5 is probably even better, but since that is not in full swing nor is it supported by all browsers, I'll stick with what works. </p> <p>According to Wikipedia, there are several ways to develop with the Comet style: Streaming (hidden iFrame, XMLHttpRequest) or AJAX with long polling (XMLHttpRequest, Script tag). However, I don't know anything about this. I've also read about the <a href="http://www.ape-project.org/" rel="nofollow noreferrer">AJAX Push Engine (APE)</a> and it looks cool, but I don't want to use a third-party for the time being.</p> <p>I've recently stumbled upon <a href="http://code.google.com/p/webchat2/" rel="nofollow noreferrer">WebChat 2.0</a> so I'm going to be looking through the source code to try and understand how it all works.</p> <h2><strong>On to the question(s)</strong></h2> <p>So where can I find example code/tutorials on how to get started with this kind of project? How would I implement the Comet technique? How do I set up the long-lived HTTP connection with the server? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload