title: XSocket.Net - Error during WebSocket handshake: Unexpected response code: 404
body: <p>I am using XSocket.Net for Real time Communication in .Net version 4.5.</p>
  
  <p>I am very new to XSocket.Net.</p>
  
  <p>The following is what i tried. In the Controller folder I created MyController with following code.</p>
  
  <pre><code>using System;
  using XSockets.Core.XSocket;
  using XSockets.Core.XSocket.Helpers;
  
  namespace XSocketTest.Controllers
  {
     public class MyController : XSocketController
     {
  
        public void OnChatMessage(string message)
        {
           this.SendTo( message, "onChatMessage");
        }
     }
  }
  </code></pre>
  
  <p>The Following is the html page "index.html" in the root location</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
   &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="text" id="input-message" value="Goo LR" /&gt;
  &lt;button id="btn-send"&gt;send&lt;/button&gt;
  &lt;div id="messages"&gt;&lt;/div&gt;
  &lt;script src="Scripts/jquery-2.1.0.min.js"&gt;&lt;/script&gt;
  &lt;script src="Scripts/XSockets.latest.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
      var conn = null;
      $(function () {
          //Create a connection
          conn = new XSockets.WebSocket('ws://localhost:4023/My');
          conn.onopen = function () {
  
  
              conn.on('onchatmessage', function (d) {
                  $('#messages').prepend($('&lt;div&gt;').text(d));
              });
          };
  
          $('#btn-send').on('click', function () {
              conn.publish('onchatmessage', { message: $('#input-message').val() });
          });
      });
    &lt;/script&gt;
  &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>I am getting an error in console(Chrome), on loading html, "WebSocket connection to 'ws://localhost:4023/My' failed: Error during WebSocket handshake: Unexpected response code: 404"</p>
  
  <p>I have no idea what I am doing wrong.</p>
  
  <p>Any help or sugggestions will be greatly appreciated.</p>