public CustomerChat(string chatId, string customerName) { this.chatId = chatId; var room = ChatRoom.Get(chatId); room.CustomerName = customerName; }
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); }); }
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)); }
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)); }
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); }); }