User-1849651236 posted
Fei Han,
The title of this article is
Send messages from outside a hub. The tutorial is presented to show that it is possible to send messages from other places in your app using the IHubContext Service.
It also says: This article explains how to access a SignalR IHubContext
to send notifications to clients from outside a hub.
Additionally, I have this Hub code in my application and it still displays the server to client messages:
using Microsoft.AspNetCore.SignalR;
using System.Threading.Tasks;
namespace ChinavasionAPI.Hubs
{
public class ChvHub : Hub
{
public async Task SendMessage(string user, string message)
{
//await Clients.All.SendAsync("ReceiveMessage", user, message);
}
}
}
That's the whole purpose of that article.
Somewhere I read that when the server is sending to a client, the Hub class does not need a method. I will try to find that and post it here.
Added on 7/17/2018 12:45PM EDST
These articles talk about not needing a Hub Send method:
Github
StackOverflow
Thanks,
Tony