Fixed opcode for binary messages

The fix will enable you to use the following clientside js in all major browsers:

var ws = new WebSocket("ws://localhost/service");
ws.onmessage = function(evt) {
  var message = evt.data;
  var type = typeof message;
  if(type == 'string') {
    // text message
    alert(message);
  } else {
    // binary message (in this example, an image)
    var url = (window.URL || window.webkitURL).createObjectURL(message);
    var img = document.createElement("IMG");
    img.onload = function() {
      document.body.appendChild(img);
    };
    img.src = url;
  }
};