code: function(recievedPeerId) {
          if (!isDeviceRegister) {
            if (registerDeviceTimeoutId) {
              clearTimeout(registerDeviceTimeoutId);
            }
  
            isDeviceRegister = true;
            peerId = recievedPeerId;
          }
  
          /**
           * If serverRegisteration == true we have to register
           * on server then make async status ready
           */
          if (serverRegisteration) {
            if (isServerRegister && peerId === oldPeerId) {
              fireEvent("asyncReady");
              isServerRegister = true;
              pushSendDataQueueHandler();
  
              socketState = socketStateType.OPEN;
              fireEvent("stateChange", {
                socketState: socketState,
                timeUntilReconnect: 0,
                deviceRegister: isDeviceRegister,
                serverRegister: isServerRegister,
                peerId: peerId
              });
            } else {
              socketState = socketStateType.OPEN;
              fireEvent("stateChange", {
                socketState: socketState,
                timeUntilReconnect: 0,
                deviceRegister: isDeviceRegister,
                serverRegister: isServerRegister,
                peerId: peerId
              });
  
              registerServer();
            }
          } else {
            fireEvent("asyncReady");
            isServerRegister = "Not Needed";
            pushSendDataQueueHandler();
  
            if (asyncLogging) {
              if (workerId > 0) {
                Utility.asyncStepLogger(workerId + "\t Async is Ready");
              } else {
                Utility.asyncStepLogger("Async is Ready");
              }
            }
  
            socketState = socketStateType.OPEN;
            fireEvent("stateChange", {
              socketState: socketState,
              timeUntilReconnect: 0,
              deviceRegister: isDeviceRegister,
              serverRegister: isServerRegister,
              peerId: peerId
            });
          }
        }
docs: *****************************************************
  P R I V A T E   M E T H O D S            *
  *****************************************************