1
我试图用彗星道场和它的例子有没有定义DojoX中没有定义
DojoX中的消息
我必须错过了一些东西明显
第一线失败这是页(误差是在所述主体的第一行):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script src="dojo/dojo.js"
data-dojo-config="async:true, parseOnLoad:true">
</script>
<script>
require(["dojox/socket"]);
</script>
</head>
<body>
<script type="text/javascript">
var socket = dojox.socket("/cometd");
function send(data) {
return socket.send(dojo.toJson(data));
}
socket.on("connect", function() {
// send a handshake
send([
{
"channel":"/meta/handshake",
"version":"1.0",
"minimumVersion":"1.0beta",
"supportedConnectionTypes":["long-polling"] // or ["callback-polling"] for x-domain
}
])
socket.on("message", function (data) {
// wait for the response so we can connect with the provided client id
data = dojo.fromJson(data);
if (data.error) {
throw new Error(error);
}
// get the client id for all future messages
clientId = data.clientId;
// send a connect message
send([
{
"channel":"/meta/connect",
"clientId":clientId,
"connectionType":"long-polling"
},
{ // also send a subscription message
"channel":"/meta/subscribe",
"clientId":clientId,
"subscription":"/foo/**"
}
]);
socket.on("message", function (data) {
alert("message from server " + data)
});
});
});
</script>
</body>
</html>
你想使用彗星?您是否按照cometD文档中的描述替换了相关的dojo文件? – perissf 2012-03-08 08:33:53