0

I've created a javascript function with a SignalR output binding, following this - https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-output?tabs=in-process&pivots=programming-language-javascript

the function runs ok but my client does not receive the message and the Message Count in the SignalR services' overview page remains 0;

What am I missing and how can I troubleshoot further?

function code -

module.exports = async function (context, req) {
    console.log(req.body);
    context.bindings.signalRMessages = [{
        "target": "newMessage",
        "arguments": [ req.body ]
    }];
    console.log(context.bindings.signalRMessages);
    console.log("function ended");
};
Yossi Dahan
  • 5,389
  • 2
  • 28
  • 50

1 Answers1

0

It was my mistake - to find out what was happening I did two things -

  1. I enabled live tracing in the Azure signalr service through the portal which then confirmed the message actually does get received by the service
  2. I then added .configureLogging(signalR.LogLevel.Debug) in my client code and saw that the error was that I had a mismatch between the target I set in the function binding and the name used in the connection.on() method's parameter
Yossi Dahan
  • 5,389
  • 2
  • 28
  • 50