title: WebSocket handshake: Unexpected response code: 404
body: <p>Am writing my first websocket program and am getting <strong>"WebSocket handshake: Unexpected response code: 404", error while loading the webpage.</strong></p>
  
  <p>I am using JDK 1.7 and jboss 8 (wildfly8.0).</p>
  
  <p>Could anyone please assist?</p>
  
  <pre><code>window.onload = init;
  var socket = new WebSocket("ws://localhost:8080/WebsocketHome/actions"); 
  socket.onmessage = onMessage; 
  </code></pre>
  
  <p>and head in html</p>
  
  <pre><code>&lt;head&gt; 
   &lt;title&gt;&lt;/title&gt;
   &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
   &lt;script src="websocket.js" type="text/javascript"&gt;&lt;/script&gt; 
   &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; 
  &lt;/head&gt;
  </code></pre>