Exemple #1
0
 // POST /api/mbus
 public void Post([FromBody] Message message)
 {
     if (message != null && !string.IsNullOrWhiteSpace(message.Sender) && !string.IsNullOrWhiteSpace(message.Content))
     {
         RecentMessages.Record(message.Sender, message.Content);
         var myHub = GlobalHost.ConnectionManager.GetHubContext <MyHub>();
         myHub.Clients.All.addMessage(message.Sender, message.Content);
     }
 }
Exemple #2
0
 public void Send(string userName, string message)
 {
     RecentMessages.Record(userName, message);
     Clients.All.addMessage(userName, message);
 }