コード例 #1
0
ファイル: SocketManager.cs プロジェクト: ubberkid/PeerATT
        /// <summary>
        /// Creates and starts opening/upgrading process of the transports.
        /// </summary>
        private void CreateTransports()
        {
#if !BESTHTTP_DISABLE_WEBSOCKET
            bool hasWSSupport = Handshake.Upgrades.Contains("websocket");
            
            if (hasWSSupport)
                Transport = new WebSocketTransport(this);
            else
#endif
                Transport = new PollingTransport(this);

            Transport.Open();
        }
コード例 #2
0
ファイル: SocketManager.cs プロジェクト: ubberkid/PeerATT
        void IManager.OnTransportError(ITransport trans, string err)
        {
            (this as IManager).EmitError(SocketIOErrors.Internal, err);

            if (trans.State == TransportStates.Connecting ||
                trans.State == TransportStates.Opening)
            {
#if !BESTHTTP_DISABLE_WEBSOCKET
                if (trans is WebSocketTransport)
                {
                    trans.Close();

                    // try to fall back
                    Transport = new PollingTransport(this);
                    Transport.Open();
                }
                else // fallback failed
#endif
                    (this as IManager).TryToReconnect();
            }
            else
            {
                trans.Close();
                (this as IManager).TryToReconnect();
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates and starts opening/upgrading process of the transports.
        /// </summary>
        private void CreateTransports()
        {
            bool hasWSSupport = Handshake.Upgrades.Contains("websocket");
            
            if (hasWSSupport)
                Transport = new WebSocketTransport(this);
            else
                Transport = new PollingTransport(this);

            Transport.Open();
        }