title: Google App Engine Channel API javascript location
body: <p>I'm a bit confused about this, and want to make sure I'm not being naive about how this works. Does the client side javascript have to also be hosted on Google App Engine? Say I create a channel on my dev server, then I have a local HTML file (non-hosted) on my computer with the required javascript, and I connect to that channel with a token - will that work? Or is this not how channels work?</p>
  
  <p><strong>Edit:</strong> </p>
  
  <p>All I have is an HTML file in the same directory as my app.yaml file (so the root directory for my website). I'm in the devserver. </p>
  
  <p>First I create a channel and get the token:</p>
  
  <pre><code>token = channel.create_channel('1')                      
  print token                                                    
  &gt;&gt;&gt; channel-4132644671-1352248413-1
  </code></pre>
  
  <p>Then I copy that token in my HTML file:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt; 
  &lt;script type="text/javascript" src="http://localhost:8080/_ah/channel/jsapi"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body &gt;
  &lt;script&gt;
  
      var token = 'channel-4132644671-1352248413-1';
      var channel = new goog.appengine.Channel(token);
      var socket = channel.open();
      socket.onopen = function() { alert('open'); };
      socket.onmessage = function() { alert('message'); };
      socket.onerror = function() { alert('error'); };
      socket.onclose = function() { alert('close'); };        
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I open the HTML file with Safari. I get an alert saying "open". However, no matter what token I type in <code>var token</code>, I get an "open" alert, so I'm not sure if getting that alert means anything.</p>
  
  <p>Then I do: 
  <code>channel.send_message('1', 'hi')</code></p>
  
  <p>And nothing happens in my HTML file. No alerts. What am I doing wrong?</p>