title: how can i create a websocket on google app engine for html5
body: <p>this is the <a href="http://html5demos.com/web-socket">demo</a> that a Simple chat client , you must open it on webkit Browser like: chrome and Safari, </p>
  
  <p>the demo use a web socket server based on node.js: websocket-server-node.js, </p>
  
  <p>but i think it cant Deploy on google app engine ,</p>
  
  <p>so did you know how to make a websocket using python on google app engine ,</p>
  
  <p>and running the demo on it ,</p>
  
  <p>thanks</p>
  
  <p>this is the code :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset=utf-8 /&gt;
  &lt;meta name="viewport" content="width=620" /&gt;
  &lt;title&gt;HTML5 Demo: Web Socket&lt;/title&gt;
  &lt;link rel="stylesheet" href="http://html5demos.com/css/html5demos.css" type="text/css" /&gt;
  &lt;script src="http://html5demos.com/js/h5utils.js"&gt;&lt;/script&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;section id="wrapper"&gt;
      &lt;header&gt;
        &lt;h1&gt;Web Socket&lt;/h1&gt;
      &lt;/header&gt;
  &lt;style&gt;
  #chat { width: 97%; }
  .them { font-weight: bold; }
  .them:before { content: 'them '; color: #bbb; font-size: 14px; }
  .you { font-style: italic; }
  .you:before { content: 'you '; color: #bbb; font-size: 14px; font-weight: bold; }
  #log {
    overflow: auto;
    max-height: 300px;
    list-style: none;
    padding: 0;
  /*  margin: 0;*/
  }
  #log li {
    border-top: 1px solid #ccc;
    margin: 0;
    padding: 10px 0;
  }
  &lt;/style&gt;
  &lt;article&gt;
    &lt;form&gt;
      &lt;input type="text" id="chat" placeholder="type and press enter to chat" /&gt;
    &lt;/form&gt;
    &lt;p id="status"&gt;Not connected&lt;/p&gt;
    &lt;p&gt;Users connected: &lt;span id="connected"&gt;0&lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;To test, open two windows with Web Socket support, type a message above and press return.&lt;/p&gt;
    &lt;p&gt;The server side code is available here: &lt;a href="http://github.com/remy/html5demos/tree/master/server/"&gt;node-web-socket &amp; server&lt;/a&gt; (note that it runs on &lt;a href="http://nodejs.org/" title="node.js"&gt;nodejs&lt;/a&gt;)&lt;/p&gt;
    &lt;ul id="log"&gt;&lt;/ul&gt;
  &lt;/article&gt;
  &lt;script&gt;
  function openConnection() {
    // uses global 'conn' object
    if (conn.readyState === undefined || conn.readyState &gt; 1) {
      conn = new WebSocket('ws://node.remysharp.com:8001');    
      conn.onopen = function () {
        state.className = 'success';
        state.innerHTML = 'Socket open';
      };
  
      conn.onmessage = function (event) {
        var message = JSON.parse(event.data);
        if (typeof message == 'string') {
          log.innerHTML = '&lt;li class="them"&gt;' + message.replace(/[&lt;&gt;&amp;]/g, function (m) { return entities[m]; }) + '&lt;/li&gt;' + log.innerHTML;
        } else {
          connected.innerHTML = message;
        }
      };
  
      conn.onclose = function (event) {
        state.className = 'fail';
        state.innerHTML = 'Socket closed';
      };
    }
  }
  
  var connected = document.getElementById('connected'),
      log = document.getElementById('log'),
      chat = document.getElementById('chat'),
      form = chat.form,
      conn = {},
      state = document.getElementById('status'),
      entities = {
        '&lt;' : '&lt;',
        '&gt;' : '&gt;',
        '&amp;' : '&amp;'
      };
  
  
  if (window.WebSocket === undefined) {
    state.innerHTML = 'Sockets not supported';
    state.className = 'fail';
  } else {
    state.onclick = function () {
      if (conn.readyState !== 1) {
        conn.close();
        setTimeout(function () {
          openConnection();
        }, 250);
      }
    };
  
    addEvent(form, 'submit', function (event) {
      event.preventDefault();
  
      // if we're connected
      if (conn.readyState === 1) {
        conn.send(JSON.stringify(chat.value));
        log.innerHTML = '&lt;li class="you"&gt;' + chat.value.replace(/[&lt;&gt;&amp;]/g, function (m) { return entities[m]; }) + '&lt;/li&gt;' + log.innerHTML;
  
        chat.value = '';
      }
    });
  
    openConnection();  
  }
  
  &lt;/script&gt;    &lt;footer&gt;&lt;a href="/"&gt;HTML5 demos&lt;/a&gt;/&lt;a id="built" href="http://twitter.com/rem"&gt;@rem built this&lt;/a&gt;/&lt;a href="#view-source"&gt;view source&lt;/a&gt;&lt;/footer&gt; 
  &lt;/section&gt;
  &lt;a href="http://github.com/remy/html5demos"&gt;&lt;img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /&gt;&lt;/a&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>