Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 26th, 2012  |  syntax: None  |  size: 0.74 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. GAE/J Channel API exception even though messages go through?
  2. getToken = function () {
  3.     xhr = new XMLHttpRequest();
  4.     xhr.open("GET", "/game?action=getChannelToken", true);
  5.     xhr.send(null);
  6.     xhr.onreadystatechange = function() {
  7.         if (this.readyState == 4 && this.status==200) {
  8.             connect(xhr.responseText);
  9.         }
  10.     };
  11. };
  12.        
  13. ChannelService channelService = ChannelServiceFactory.getChannelService();
  14. channelToken = channelService.createChannel(uid);
  15.        
  16. connect = function (token) {
  17. //  alert ("connect");
  18.     var channel = new goog.appengine.Channel(token);
  19.     var socket = channel.open();
  20.     socket.onopen = onOpened;
  21.     socket.onmessage = onMessage;
  22.     socket.onerror = onError;
  23.     socket.onclose = onClose;
  24. };