Opened 9 years ago
Closed 9 years ago
#14982 closed defect (invalid)
dojo.require("dojox.cometd"); doesn't work in 1.7.2
Reported by: | creakytrain | Owned by: | creakytrain |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dojox | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Bringing in dojox.cometd doesn't work. dojox.cometd will be an undefined object.
Try the example below which comes straight from the dojox.cometd example on the website:
<html><head> <script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js"></script> <!-- then try this for version 1.7.1 and it will work fine <script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js"></script> --> <script type="text/JavaScript"> dojo.require("dojo.io.script"); dojo.require("dojox.cometd"); dojo.require("dojox.cometd.callbackPollTransport"); dojo.ready(function(){ dojox.cometd.init("http://cometd.dojocampus.org:9000/cometd"); dojox.cometd.subscribe("/demo", function(message){ console.log("received", message); dojo.byId("messageLog"). appendChild(document.createElement("div")). appendChild(document.createTextNode(message.data.from + ": " + message.data.text)); }); dojo.connect(dojo.byId("send"), "onclick", function(){ if(!dojo.byId("sendName").value.length || !dojo.byId("sendText").value.length){ alert("Please enter some text"); return; } dojox.cometd.publish("/demo", { from: dojo.byId("sendName").value, text: dojo.byId("sendText").value }); }); }); </script> </head> <body> <div id="chatroom"> <div style="clear: both;"><label for="sendName" style="float: left; width: 100px; padding: 3px;">Name:</label> <input id="sendName" typ\ e="text" data-dojo-type="dijit.form.TextBox"></div> <div style="clear: both;"><label for="sendText" style="float: left; width: 100px; padding: 3px;">Message:</label> <input id="sendText" \ type="text" data-dojo-type="dijit.form.TextBox"><button id="send" data-dojo-type="dijit.form.Button">Send Message</button></div> <div id="messageLog"><strong>Messages:</strong></div> </div> </body></html>
Change History (5)
comment:1 Changed 9 years ago by
Owner: | set to creakytrain |
---|---|
Status: | new → pending |
comment:2 Changed 9 years ago by
Component: | General → Dojox |
---|
comment:3 follow-up: 4 Changed 9 years ago by
At the moment, you should use the code that's contained within the CometD project, e.g. https://github.com/cometd/cometd/tree/master/cometd-javascript/dojo/
We're working with them to get this fully updated for AMD in the near future.
comment:4 Changed 9 years ago by
Replying to dylan:
At the moment, you should use the code that's contained within the CometD project, e.g. https://github.com/cometd/cometd/tree/master/cometd-javascript/dojo/
Just to confirm, I've been using the cometd 2.4.0 release in a dojo 1.7.2 without major problems. Of course you have to run the 2.4.0 cometd server somewhere. I use AMD syntax, and so long as you leave "async:false" in your data-dojo-config to avoid loader bugs to do with the ready() system not working, you should be fine.
How to get the javascript client and overwrite what's shipped in dojo is explained here: http://cometd.org/documentation/howtos/primer under "The non-maven way".
comment:5 Changed 9 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Hmm, neither 1.7.1 or 1.7.2 is working for me since http://cometd.dojocampus.org:9000/cometd isn't a valid link. (Dojo campus is gone.)
And I'm not seeing any sort of initial error when it points to 1.7.2 about dojox.cometd being undefined.
Can you explain what exact error you are seeing, and give a test case that works better against 1.7.1?