
Untitled
By: a guest on
Jun 26th, 2012 | syntax:
None | size: 0.74 KB | hits: 8 | expires: Never
GAE/J Channel API exception even though messages go through?
getToken = function () {
xhr = new XMLHttpRequest();
xhr.open("GET", "/game?action=getChannelToken", true);
xhr.send(null);
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status==200) {
connect(xhr.responseText);
}
};
};
ChannelService channelService = ChannelServiceFactory.getChannelService();
channelToken = channelService.createChannel(uid);
connect = function (token) {
// alert ("connect");
var channel = new goog.appengine.Channel(token);
var socket = channel.open();
socket.onopen = onOpened;
socket.onmessage = onMessage;
socket.onerror = onError;
socket.onclose = onClose;
};