Пример #1
0
        public override async Task Process(IXFireClient context)
        {
            var loginChallenge = new LoginChallenge();
            await loginChallenge.Process(context);

            await context.SendMessage(loginChallenge);
        }
Пример #2
0
        // TODO: Create test for this message so we can refactor and build this message the same way as the others to avoid the switch statement
        // TODO: How to tell the client we didn't receive the ACK?
        // TODO: P2P stuff???
        public override void Process(IXFireClient context)
        {
            var otherSession = context.Server.GetSession(SessionId);

            if (otherSession == null)
            {
                return;
            }

            var messageType = (ChatMessageType)(byte)MessagePayload["msgtype"];

            switch (messageType)
            {
            case ChatMessageType.Content:
                var responseAck = BuildAckResponse(otherSession.SessionId);
                context.SendMessage(responseAck);

                var chatMsg = BuildChatMessageResponse(context.SessionId);
                otherSession.SendMessage(chatMsg);
                break;

            case ChatMessageType.TypingNotification:
                var typingMsg = BuildChatMessageResponse(context.SessionId);
                otherSession.SendMessage(typingMsg);
                break;

            default:
                context.Logger.LogDebug($"NOT BUILT: Got {messageType} for session: {context.SessionId}");
                break;
            }
        }
Пример #3
0
        public override void Process(IXFireClient context)
        {
            var loginChallenge = new LoginChallenge();

            loginChallenge.Process(context);
            context.SendMessage(loginChallenge);
        }