Esempio n. 1
0
        public async Task Post(string connectionId, Message message)
        {
            if (message is null)
            {
                return;
            }
            message.ServerDateTime = DateTime.Now;
            _logger.LogDebug($"{message.ServerDateTime}| Receive message {message.Text}, Order: {message.Order}");

            // send message to recipients
            await _HubContext.Clients.AllExcept(connectionId).SendAsync("ReceiveMessage", new
            {
                message.Text,
                message.Id,
                message.Order,
                ServerDateTime = message.ServerDateTime.ToString("yyyy-MM-dd HH:mm:ss")
            });

            // send message to database
            _MessageData.PostMessage(message);
        }
Esempio n. 2
0
        public async Task apc(string connectionId, Message message)
        {
            message.ServerDateTime = DateTime.Now;
            _logger.LogDebug($"{message.ServerDateTime}| Receive message {message.Text}, Order: {message.Order}");

            await _HubContext.Clients.AllExcept(connectionId).SendAsync("ReceiveMessage", new
            {
                message.Text,
                message.Id,
                message.Order,
                ServerDateTime = message.ServerDateTime.ToString("yyyy-MM-dd HH:mm:ss")
            });

            _MessageData.PostMessage(message);
        }
Esempio n. 3
0
 public void PostMessage(Message message)
 {
     _logger.LogDebug($"Save message {message.Text}");
     _MessageData.PostMessage(message);
     _logger.LogDebug($"Message saved");
 }