title: getting the reason why websockets closed with close code 1006
body: <p>I would like to get the reason websockets closed, so I can show the right message to the user.</p>
  
  <p>I have</p>
  
  <pre><code>sok.onerror=function (evt) 
       {//since there is an error, sockets will close so...
         sok.onclose=function(e){
             console.log("WebSocket Error: " , e);}
  </code></pre>
  
  <p>The code is always 1006 and the reason is always " ". But I want to tell different closing reasons apart.</p>
  
  <p>For example the comand line gives an error reason : "you cannot delete that, because database wont let you". But on Chrome's console, the reason is still " ". </p>
  
  <p>Any other way to tell different closing reasons apart?</p>