Thanks a lot for your example.<br>I think my problem is that the tomcat 5 CometProcessor Servlet doesn&#39;t support Bayeux and dojo cometd requires it. There is almost no documentation for the tomcat comet support. <br>In firebug I see a single POST to my comet servlet. This stays active for several minutes, and after this timeout I see the messages I have sent from the server to the browser.
<br><br><div><span class="gmail_quote">2007/6/5, Michael Jasnowski &lt;<a href="mailto:mjasnows@bea.com">mjasnows@bea.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here is a basic example what I did, using dojo.io.cometd, and Jetty<br>Continuations within Tomcat 5.5. OOTB &quot;long-polling&quot; transport was<br>selected by default, also note I have some additional connects to<br>functions for tracking lifecycle of connection but those are not
<br>strictly required.&nbsp;&nbsp;Also note that using the Jetty module requires<br>additional configuration via. web.xml.&nbsp;&nbsp;As long as it&#39;s cometd / Bayeux<br>protocol, this client side code should work with Tomcat 6 AFAIK:<br>
<br>1) Setup the connection when the page loads<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dojo.require(&quot;dojo.io.cometd&quot;);<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function setUpConnection(){<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dojo.event.connect(cometd,&quot;finishInit&quot;,function(type, data, evt,
<br>request){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //alert(&quot;Finished Initializing..&quot; + request);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; transportObject = request;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // subscribe once connection is finished initializing<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
cometd.subscribe(&quot;/events/received&quot;, true, &quot;serverSentEvent&quot;);<br>// was +cometd.clientId;<br>&nbsp;&nbsp;&nbsp;&nbsp;});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;dojo.event.connect(cometd,&quot;tunnelInit&quot;,function(type, data, evt,<br>request){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;TunnelInit...&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;cometd.init({}, &quot;/appcontextpath/cometd&quot;); // replace appcontextpath<br>with your applications context path<br><br><br>//&nbsp;&nbsp;&nbsp;&nbsp;cometd.subscribe(&quot;/events/received&quot;, true, &quot;serverSentEvent&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;// set connected state for page<br>&nbsp;&nbsp;&nbsp;&nbsp;// this should possibly only be set on callback notification<br><br>&nbsp;&nbsp;&nbsp;&nbsp;connected = true;<br><br>}<br><br><br>2) serverSentEvent is the callback function for when a message is
<br>received. In my case I take the callback and publish it&#39;s contents to a<br>topic locally in the browser, using dojo.event.topic, but that&#39;s not<br>require.<br>3) publish a message to &quot;/events/received&quot;, for testing you can setup a
<br>JS function on the same page for testing<br><br>function testDOJOEvent(){<br>&nbsp;&nbsp;&nbsp;&nbsp;cometd.publish(&quot;/events/received&quot;, {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;source: cometd.clientId<br>&nbsp;&nbsp;&nbsp;&nbsp;});<br><br>}<br><br>Here I&#39;m just pinging, with no message sent. I also have a Java client
<br>that posts messages on the same channel from the server side (i.e. to<br>send events to the browser), via org.mortbay.cometd.Channel.publish(). I<br>believe there is also a chat example floating around on the net that
<br>should be applicable as well.<br><br>HTH,<br>Mike<br><br><br>-----Original Message-----<br>From: <a href="mailto:dojo-interest-bounces@dojotoolkit.org">dojo-interest-bounces@dojotoolkit.org</a><br>[mailto:<a href="mailto:dojo-interest-bounces@dojotoolkit.org">
dojo-interest-bounces@dojotoolkit.org</a>] On Behalf Of James Burke<br>Sent: Monday, June 04, 2007 11:19 PM<br>To: <a href="mailto:dojo-interest@dojotoolkit.org">dojo-interest@dojotoolkit.org</a><br>Subject: Re: [Dojo-interest] 
dojo.io.bind for tomcat 6 comet<br>implementation<br><br>On 6/4/07, Bernd Winterstein &lt;<a href="mailto:bernd.winterstein@googlemail.com">bernd.winterstein@googlemail.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt; I have a tomcat 6 CometProcessor servlet which periodically sends
<br>messages<br>&gt; to the client page. Now I&#39;m trying to create a html page with dojo<br>&gt; javascript which shows the received messages. But I don&#39;t find an<br>working<br>&gt; example, and all my attempt lead to errors.
<br>&gt; What is the right transport mode? XmlHttpRequest or IframeTransport?<br><br>dojo.io.cometd is the best bet, but I do not know how to use it.<br><br>James<br>_______________________________________________<br>FAQ: 
<a href="http://dojotoolkit.org/support/faq">http://dojotoolkit.org/support/faq</a><br>Book: <a href="http://dojotoolkit.org/docs/book">http://dojotoolkit.org/docs/book</a><br>Forums: <a href="http://dojotoolkit.org/forum">
http://dojotoolkit.org/forum</a><br><a href="mailto:Dojo-interest@dojotoolkit.org">Dojo-interest@dojotoolkit.org</a><br><a href="http://dojotoolkit.org/mailman/listinfo/dojo-interest">http://dojotoolkit.org/mailman/listinfo/dojo-interest
</a><br><br>Notice:&nbsp;&nbsp;This email message, together with any attachments, may contain information&nbsp;&nbsp;of&nbsp;&nbsp;BEA Systems,&nbsp;&nbsp;Inc.,&nbsp;&nbsp;its subsidiaries&nbsp;&nbsp;and&nbsp;&nbsp;affiliated entities,&nbsp;&nbsp;that may be confidential,&nbsp;&nbsp;proprietary,&nbsp;&nbsp;copyrighted&nbsp;&nbsp;and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.
<br>_______________________________________________<br>FAQ: <a href="http://dojotoolkit.org/support/faq">http://dojotoolkit.org/support/faq</a><br>Book: <a href="http://dojotoolkit.org/docs/book">http://dojotoolkit.org/docs/book
</a><br>Forums: <a href="http://dojotoolkit.org/forum">http://dojotoolkit.org/forum</a><br><a href="mailto:Dojo-interest@dojotoolkit.org">Dojo-interest@dojotoolkit.org</a><br><a href="http://dojotoolkit.org/mailman/listinfo/dojo-interest">
http://dojotoolkit.org/mailman/listinfo/dojo-interest</a><br></blockquote></div><br>