title: Porting node.js server-side code to HTML5 WebSockets
body: <p>Note:  This is not about using both node.js and HTML5 sockets.  I'm also not interested in discussing the merits of the setup I'm describing.</p>
  
  <p>node.js runs on the server, and, since it supports connecting via sockets <em>as a client</em>, it can act as a middle layer between an HTML5/JS client and server that uses TCP/IP (such as a database server.)  So, both node.js and WebSockets include ways of opening socket connections to a server.</p>
  
  <p>My question is, has anyone successfully ported a node.js script to WebSockets, i.e., cut node.js out of the equation, so that your web browser connects to the database directly?  I imagine it would look like:</p>
  
  <ol>
  <li>cut out everything to do with HTTP</li>
  <li>port the usage of all node.js-specific functions to use the WebSockets API</li>
  </ol>
  
  <p>If this has been done, was it a lot of trouble or were the node.js and WebSockets APIs relatively similar?</p>