Skip to content Skip to sidebar Skip to footer

Debugging Channel Api Appengine

I'm using the appengine channel api(with deferred tasks) but it doesn't seem to be working. Here's my server code in a gist: Class Handler(webapp2.RequestHandler): def get(self)

Solution 1:

This now seems to be working. Apparently the socket request javascript should be in html body and not in head. The working javascript looks like this:

<html>
  <body>
    <script type="text/javascript" src="/_ah/channel/jsapi"></script>
    <script>
        channel = new goog.appengine.Channel('{{ token }}');
        socket = channel.open();
        socket.onmessage = function() {
            var xhr = new XMLHttpRequest();
            xhr.open('GET', '/secondpage');
            xhr.send();
        };
      </script>
  </body>

Post a Comment for "Debugging Channel Api Appengine"