示例#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 void Process(Context context)
        {
            var otherSession = context.Server.GetSession(SessionId);
            var messageType = (byte)MessagePayload["msgtype"];

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

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

                case 1:
                    Debug.WriteLine("NOT BUILT: Got ACK for session " + context.SessionId);
                    break;

                case 2:
                    Debug.WriteLine("NOT BUILT: Got P2P info for session " + context.SessionId);
                    break;

                case 3:
                    var typingMsg = BuildChatMessageResponse(context.SessionId);
                    otherSession.SendMessage(typingMsg);
                    break;
            }
        }
示例#2
0
 public void Process(Context context)
 {
     var loginChallenge = new LoginChallenge();
     loginChallenge.Process(context);
     context.SendMessage(loginChallenge);
 }