public override async Task <bool> OnMessageReceived(ProtocolMessage message, RealtimeState state) { if (message == null) { throw new ArgumentNullException(nameof(message), "Null message passed to Connection Connecting State"); } switch (message.Action) { case ProtocolMessage.MessageAction.Connected: { if (Context.Transport.State == TransportState.Connected) { TransitionState(SetConnectedStateCommand.Create(message, false) .TriggeredBy("ConnectingState.OnMessageReceived(Connected)")); } return(true); } case ProtocolMessage.MessageAction.Disconnected: { Context.ExecuteCommand(HandleConnectingDisconnectedCommand.Create(message.Error) .TriggeredBy("ConnectingState.OnMessageReceived(Disconnected)")); return(true); } case ProtocolMessage.MessageAction.Error: { Context.ExecuteCommand(HandleConnectingErrorCommand.Create(message.Error) .TriggeredBy("ConnectingState.OnMessageReceived(Error)")); return(true); } } return(false); }
private void OnTimeOut() { Context.ExecuteCommand(HandleConnectingDisconnectedCommand.Create(new ErrorInfo("Connecting timeout", ErrorCodes.ConnectionTimedOut, HttpStatusCode.GatewayTimeout)).TriggeredBy("ConnectingState.OnTimeOut()")); }