establishWebsocketConnection = function() {

        var websocketUrl = (location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.hostname + ':' + window.location.port;

        if (websocket.connection === null) {

          websocket.connection = new WebSocket(websocketUrl);

          websocket.connection.onopen = function() {
            $rootScope.$broadcast("start-linux-dash", {});
            $rootScope.$apply();
            console.info('Websocket connection is open');
          };

          websocket.connection.onmessage = function(event) {

            var response = JSON.parse(event.data);
            var moduleName = response.moduleName;
            var moduleData = JSON.parse(response.output);

            if (!!websocket.onMessageEventHandlers[moduleName]) {
              websocket.onMessageEventHandlers[moduleName](moduleData);
            } else {
              console.info("Websocket could not find module", moduleName, "in:", websocket.onMessageEventHandlers);
            }

          };

          websocket.connection.onclose = function() {
            websocket.connection = null;
          }
        }

      }
@description:
  Establish a websocket connection with server

@return Null