Debug function using a SignalRTrigger

Darren Wainwright 21 Reputation points
2020-11-11T14:32:07.11+00:00

Hi folks,

I'm building a function app in Node.js/TypeScript that will react to messages to and from a SignalR Service (in serverless mode)

I have the following function, shown in the image below.

My question is how do I actually debug this function?

More specifically, what are the steps I need to take to invoke this method.

I've been following this document: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-trigger?tabs=javascript however, i don't understand the last section "Send messages to SignalR Service trigger binding" - it seems like there should be more info; such as where this URL is, what the POST body will look like etc.

Really need some help folks.

Thanks in advance

39084-image.png

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,328 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
121 questions
{count} votes

Accepted answer
  1. Chenyang Liu 151 Reputation points
    2020-11-24T03:33:05.577+00:00

    @Darren Wainwright SignalRTrigger gets invoked by SignalR Service, so you don't need to generate your own POST request.

    The workflow shown as below:
    Clients (signalr client sdk in C# or Javascript) --> SignalR Service --> SignalR Trigger
    SignalR Output binding --> SignalR Service --> Clients

    Please try the bi-direction chat at first. It shows how to use SignalR Trigger with upstream feature e2e: https://github.com/aspnet/AzureSignalR-samples/tree/master/samples/BidirectionChat

    You need to do several things in the sample. Deploy a function to Azure Function and set upstream.
    If you have more questions, feel free to contact me.


1 additional answer

Sort by: Most helpful
  1. Ryan Hill 26,146 Reputation points Microsoft Employee
    2020-11-12T05:15:37.68+00:00

    Hi @Darren Wainwright ,

    Your deviceInformation function is listening for broadcast messages sent from your Azure SignalR Service. You'll need to a method that will send messages to your mailbox hub for your deviceInformation function to be triggered by.

    The easiest and simplest way to do this is add another HTTP trigger function that will use SignalR as an output binding. See https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-output?tabs=javascript for a step-by-step creating a function configured for SignalR output binding. When you hit F5, the VS Code Azure Function tools should run your local host environment where it will list your two routes. All you'll need to do is invoke your route with the SignalR output binding and you should hit a breakpoint you've set on your SignalRTrigger input binding function.

    Regards,
    Ryan