/// <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(); }
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(); } }
/// <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(); }