private static ServiceMessage? ParseMessage()

in src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs [70:164]


    private static ServiceMessage? ParseMessage(ref MessagePackReader reader)
    {
        var arrayLength = reader.ReadArrayHeader();

        var messageType = reader.ReadInt32();

        switch (messageType)
        {
            case ServiceProtocolConstants.HandshakeRequestType:
                return CreateHandshakeRequestMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.HandshakeResponseType:
                return CreateHandshakeResponseMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.AccessKeyRequestType:
                return CreateAccessKeyRequestMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.AccessKeyResponseType:
                return CreateAccessKeyResponseMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.PingMessageType:
                return CreatePingMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.OpenConnectionMessageType:
                return CreateOpenConnectionMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CloseConnectionMessageType:
                return CreateCloseConnectionMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ConnectionDataMessageType:
                return CreateConnectionDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ConnectionReconnectMessageType:
                return CreateConnectionReconnectMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.MultiConnectionDataMessageType:
                return CreateMultiConnectionDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.UserDataMessageType:
                return CreateUserDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.MultiUserDataMessageType:
                return CreateMultiUserDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.BroadcastDataMessageType:
                return CreateBroadcastDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.JoinGroupMessageType:
                return CreateJoinGroupMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.LeaveGroupMessageType:
                return CreateLeaveGroupMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.UserJoinGroupMessageType:
                return CreateUserJoinGroupMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.UserLeaveGroupMessageType:
                return CreateUserLeaveGroupMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.UserJoinGroupWithAckMessageType:
                return CreateUserJoinGroupWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.UserLeaveGroupWithAckMessageType:
                return CreateUserLeaveGroupWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.GroupBroadcastDataMessageType:
                return CreateGroupBroadcastDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.MultiGroupBroadcastDataMessageType:
                return CreateMultiGroupBroadcastDataMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ServiceErrorMessageType:
                return CreateServiceErrorMessage(ref reader);
            case ServiceProtocolConstants.ServiceEventMessageType:
                return CreateServiceEventMessage(ref reader);
            case ServiceProtocolConstants.JoinGroupWithAckMessageType:
                return CreateJoinGroupWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.LeaveGroupWithAckMessageType:
                return CreateLeaveGroupWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CheckUserInGroupWithAckMessageType:
                return CreateCheckUserInGroupWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CheckGroupExistenceWithAckMessageType:
                return CreateGroupExistenceWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CheckConnectionExistenceWithAckMessageType:
                return CreateCheckConnectionExistenceWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CheckUserExistenceWithAckMessageType:
                return CreateCheckUserExistenceWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CloseConnectionsWithAckMessageType:
#pragma warning disable CS0612 // Type or member is obsolete
                return CreateCloseConnectionsWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CloseConnectionWithAckMessageType:
                return CreateCloseConnectionWithAckMessage(ref reader, arrayLength);
#pragma warning restore CS0612 // Type or member is obsolete
            case ServiceProtocolConstants.CloseUserConnectionsWithAckMessageType:
                return CreateCloseUserConnectionsWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.CloseGroupConnectionsWithAckMessageType:
                return CreateCloseGroupConnectionsWithAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.AckMessageType:
                return CreateAckMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ClientInvocationMessageType:
                return CreateClientInvocationMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ClientCompletionMessageType:
                return CreateClientCompletionMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ErrorCompletionMessageType:
                return CreateErrorCompletionMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ServiceMappingMessageType:
                return CreateServiceMappingMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.ConnectionFlowControlMessageType:
                return CreateConnectionFlowControlMessage(ref reader, arrayLength);
            case ServiceProtocolConstants.GroupMemberQueryMessageType:
                return CreateGroupMemberQueryMessage(ref reader, arrayLength);
            default:
                // Future protocol changes can add message types, old clients can ignore them
                return null;
        }
    }