Пример #1
0
        public CustomerChat(string chatId, string customerName)
        {
            this.chatId = chatId;

            var room = ChatRoom.Get(chatId);

            room.CustomerName = customerName;
        }
Пример #2
0
        protected override void OnReceive(object message)
        {
            message.Match().With <ChatQuery.GetAllMessages>(get =>
            {
                var room     = ChatRoom.Get(get.ChatId);
                var messages = room.Messages;
                var ready    = new ChatQuery.MessagesReady(messages);

                Sender.Tell(ready);

                Context.Stop(Self);
            });
        }
Пример #3
0
        private void SendMessage(Chat.SendSupportMessage message)
        {
            if (chatId != message.ChatId)
            {
                return;
            }

            var room = ChatRoom.Get(message.ChatId);

            room.AddSupportMessage(message.Text);

            ChatContext.MessageRouter.Tell(new ChatQuery.ReturnMessages(message.ChatId));
        }
Пример #4
0
        private void JoinChat(Chat.Join message)
        {
            if (chatId != message.ChatId)
            {
                return;
            }

            var room = ChatRoom.Get(message.ChatId);

            room.Joined = true;

            ChatContext.MessageRouter.Tell(new ChatQuery.ReturnMessages(message.ChatId));
        }
Пример #5
0
        protected override void OnReceive(object message)
        {
            message.Match().With <ChatQuery.ReturnMessages>(fulfill =>
            {
                if (query.ChatId != fulfill.ChatId)
                {
                    return;
                }

                var room     = ChatRoom.Get(query.ChatId);
                var messages = room.Messages.Skip(query.Skip);
                var ready    = new ChatQuery.MessagesReady(messages);

                sender.Tell(ready);

                Context.Stop(Self);
            });
        }