users@glassfish.java.net

Re: Helloworld Comet problem

From: <glassfish_at_javadesktop.org>
Date: Wed, 25 Feb 2009 13:12:18 PST

I have there are some issues in Javascript.
I rewrite it as follows. It is working fine in currently Grizzly workspace.

<script type="text/javascript">
            dojo.require("dojox.cometd");

            function setUp() {
                //dojox.cometd.init("cometd");
                dojox.cometd.startBatch();
                dojox.cometd.init(new String(document.location).replace(/http:\/\/[^\/]*/,'').replace(/\/\/.*$/,'\/cometd')+"cometd");
                dojox.cometd.subscribe("/hello/world", "publishHandler");
                dojox.cometd.endBatch();
            }

            function publishHandler(msg) {
                alert(msg.data.test);
            }

           dojo.addOnLoad(setUp);
        </script>
[Message sent by forum member 'swchan2' (swchan2)]

http://forums.java.net/jive/thread.jspa?messageID=333859