Chrome WebSocket - onopen is not a function Chrome WebSocket - onopen is not a function google-chrome google-chrome

Chrome WebSocket - onopen is not a function


The function is not correctly assigned to the onopen event. Do it like this instead:

var ws = new WebSocket('ws://localhost:8002/', 'a')ws.onopen = function() {  console.log("ok")};

http://www.tutorialspoint.com/html5/html5_websocket.htm