title: Websocket With Socket.io & Angular
body: <p>I want to create a websocket to add a communication between my angular app and my database. The app shall be able to save a question in a database &amp; to notify the user when somebody answered.</p>
  
  <p>Unfortunately I tried some tutorials which all don't work. I'm totally new to this because I use apache usually. So If you know a "working", very basic (beginner) tutorial, which doesn't require to install lots of additional things like yeoman etc. I would be glad. </p>
  
  <p>In the current tutorial I get the error message:</p>
  
  <pre><code>You are trying to attach socket.io to an express request handler function. Please pass a http.Server instance.
  </code></pre>
  
  <p>My server.js: </p>
  
  <pre><code>var connect = require('connect'),
      serveStatic = require('serve-static'),
      socket = require('socket.io');
  
  var server = connect();
  
  server.use(serveStatic(__dirname+'/../client'));
  server.listen(8080);
  var io = socket.listen(server);
  console.log("Server started and listen to http://127.0.0.1:8080");
  </code></pre>
  
  <p>without </p>
  
  <pre><code>var io = socket.listen(server);
  </code></pre>
  
  <p>it serves my static page. </p>
  
  <hr>
  
  <p>This error is on my other approach:</p>
  
  <pre><code>has no method 'use'
  </code></pre>
  
  <p>My server.js</p>
  
  <pre><code>var connect = require('connect');
  var http = require('http');
  var serveStatic = require('serve-static');
  var app = connect();
  var server = http.createServer(app).use(serveStatic(__dirname+'/../client')).listen(3000);
  
  var socket = require('socket.io');
  var io = socket.listen(server);
  </code></pre>