added console.log to ws.onopen, ws.onclose, ws.onmessage and ws.onerror