Exemple #1
0
        void Start()
        {
            if (_singletonChecker)
            {
                DebugerUtils.DebugAssert(false, "fatal error! Cannot initialize two WebSocketHost!");
                return;
            }

            _singletonChecker = true;

            this._socketGateway = new SocketGateway(this);

            this.m_InternetState = NetworkReachability.NotReachable;

            SocketApi.ResetState();
        }
        public SocketGateway(WebSocketHost host)
        {
            if (m_Instance != null)
            {
                DebugerUtils.DebugAssert(false, "fatal error: duplicated socket gateways is not allowed!");
                return;
            }

            m_Instance  = this;
            this.m_Host = host;

            this.m_CandidateURLs  = new List <string>();
            this.m_CandidateIndex = 0;
            this.m_PayloadQueue   = new List <string>();
            this.m_BackOff        = new BackOff(host, 1000, 30000);
            this.m_CommitId       = null;
            this.m_Socket         = null;

            this._Reset(isInit: true);
        }