establishWebSocketConn = (
  url,
  onOpen = null,
  onMessage = null,
  onClose = null,
  onError = null
) => {
  let conn = null;
  if (isWebsocketSupport()) {
    conn = new WebSocket(url);

    conn.onopen = onOpen;
    conn.onmessage = onMessage;
    conn.onclose = onClose;
    conn.onerror = onError;
  } else {
    // TODO implement a fallback which polls but mimics the interface of a WebSocket Object.
    console.log(
      'This console needs websockets and websockets is not supported by your browser.'
    );
    alert(
      'This console needs websockets and websockets is not supported by your browser.'
    );
  }
  return conn;
}
Returns a WebSocket connect object.
@param  {String} url              The url which needs to be contacted.
@param  {Function} [onOpen=null]  The callback function which is called once the websocket connection is established.
@param  {Function} [onMessage=null] The callback function which receives one argument event. Use event.data for data of the event.
@param  {Function} [onClose=null]   The callback function which is called when the connection is closed.
@param  {Function} [onError=null]   The callback function which is called when an error occurs, receives one argument called error.
@return {WebSocket}                  The WebSocket object. Use send(data) to send data & close() to terminate the connection.