title: Setting up Django Channels
body: <p>I have been trying to integrate Django channels into my existing Django application. </p>
  
  <p>Here's my routing.py:</p>
  
  <pre><code>from channels.routing import route
  
  channel_routing = [
      route('websocket.receive', 'chat.consumers.ws_echo', path=r'^/chat/$'),
  ]
  </code></pre>
  
  <p>Here's my consumers.py:</p>
  
  <pre><code>def ws_echo(message):
      message.reply_channel.send({
          'text': message.content['text'],
      })
  </code></pre>
  
  <p>I am trying to create a socket by doing this:</p>
  
  <pre><code>ws = new WebSocket('ws://' +  window.location.host + '/chat/');
  
  ws.onmessage = function(message) {
    alert(message.data);
  };
  
  ws.onopen = function() {
    ws.send('Hello, world');
  };
  </code></pre>
  
  <p>When I run this code, I get the following error in my console: </p>
  
  <pre><code>WebSocket connection to 'ws://localhost:8000/chat/' failed: Error during WebSocket handshake: Unexpected response code: 404
  </code></pre>
  
  <p>On my server, I get the following error:</p>
  
  <pre><code>HTTP GET /chat/ 404
  </code></pre>
  
  <p>Based on the error, I think that Django is giving a http connection rather than a ws connection.</p>
  
  <p>Any help on this issue is greatly appreciated.</p>