public void SendMessage(string chatRoomId, ChatMessageTextDTO message) { this._koalaChatHubContext .Clients .All .SendAsync(chatRoomId, message.User, message.Date, message.Text); }
private void EventingBasicConsumer_Received(object sender, BasicDeliverEventArgs e) { QueueMessageDTO queueMessage = JsonConvert .DeserializeObject <QueueMessageDTO>(Encoding.UTF8 .GetString(e.Body.ToArray())); ChatMessageTextDTO chatMessageText = new ChatMessageTextDTO { Date = DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm"), RoomId = Guid.Parse(queueMessage.RoomId), RoomName = string.Empty, Text = queueMessage.Quote, User = _userRepository .Get(new UserSpecification("bot@koalaappchat")) .FirstOrDefault() .UserName }; _chatHubService.SendMessage(queueMessage.RoomId, chatMessageText); }