示例#1
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(XFireClient 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:
                Debug.WriteLine($"NOT BUILT: Got {messageType} for session: {context.SessionId}");
                break;
            }
        }
示例#2
0
        public override void Process(XFireClient context)
        {
            var loginChallenge = new LoginChallenge();

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