Asure SignalR service hub breakpoint not hit from Azure Function

318 Views Asked by At

I am prototyping calling a SignalR hub from front end code and a Azure Function (through Azure SignalR Service). I have it working at a basic level but the breakpoint in my hub is not being hit when called from the Azure Function.

Hub (complete code, no other methods):

    public class JobHub : Hub
    {
        public void BroadcastMessage(string name, string message)
        {
            Clients.All.SendAsync("broadcastMessage", name, message);
        }

Azure Function:

    public static class SignalRPrototypeFunction
    {
        [FunctionName("GarageUpdated")]
        public static async Task<ActionResult> Run
        (
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
            [SignalR(HubName = "JobHub")] IAsyncCollector<SignalRMessage> signalRMessages,
            ILogger log)
        {

            await signalRMessages.AddAsync
            (
                new SignalRMessage()
                {
                    Target = "broadcastMessage",
                    Arguments = new[] { "Azure", "Hello" }
                }
            );

            return new OkResult();
        }
    }

When I connect to my Azure SignalR Service from the browser I have a button press that does connection.send('broadcastMessage', "username", "message"); which hits a breakpoint on Clients.All.SendAsync("broadcastMessage", name, message); of the hub.

Doing the call from the function does push the message through to the front end (so it must be going through this line?) but the breakpoint doesn't get hit.

Any ideas?

0

There are 0 best solutions below