For example, every minute the application makes some monsters move. If these monsters are around a certain player, I would like him to know.
If you like to call the hub method from your Azure Functions application to transfer information about the location of monsters to certain players, you can refer to the following sample, which works fine on my side.
Hub class
public class ChatHub : Hub { public void BroadcastMonstersPosition(string MonsterPositionInfo) { Clients.All.addNewMessageToPage(MonsterPositionInfo); }
Azure Functions app (timerTrigger)
using System; public static void Run(TimerInfo myTimer, TraceWriter log) { var hub = new Microsoft.AspNet.SignalR.Client.HubConnection("http://xxxxxx.azurewebsites.net/signalr/hubs"); var proxy = hub.CreateHubProxy("ChatHub"); hub.Start().Wait();
function.json
{ "bindings": [ { "name": "myTimer", "type": "timerTrigger", "direction": "in", "schedule": "0 */1 * * * *" } ], "disabled": false }
project.json
{ "frameworks": { "net46":{ "dependencies": { "Microsoft.AspNet.SignalR.Client": "2.2.0" } } } }
A customer user may receive a message that the Azure Functions application is sending

In addition, if you want to broadcast specific players, and not all connecting players, you can refer to the following code.
Clients.Clients(clientids_list).addNewMessageToPage(MonsterPositionInfo);
source share