✅ SignalR trigger for Azure Function (isolated) does not trigger.
Trying to set up a SignalR trigger that recieves a message from the client. The negotiate work fine, and the connection gets established. I see the message being sent from the client as well, but my function never triggers.
The message that gets sent:
{"arguments":["Hello from client"],"invocationId":"0","streamIds":[],"target":"sendMessage","type":1}
{"arguments":["Hello from client"],"invocationId":"0","streamIds":[],"target":"sendMessage","type":1}
Azure function:
using Microsoft.Azure.Functions.Worker;using Microsoft.Azure.Functions.Worker.Http;using Microsoft.Extensions.Logging;namespace HueCue.API;public class Api(ILogger<Api> logger){ private const string HubName = "ChatRoom"; [Function("negotiate")] public string Negotiate( [HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req, [SignalRConnectionInfoInput(HubName = HubName, ConnectionStringSetting = "AzureSignalR")] string connectionInfo) { logger.LogInformation($"SignalR Connection data requested: {connectionInfo}"); return connectionInfo; } [Function(nameof(SendMessage))] public void SendMessage( [SignalRTrigger(HubName,"messages", nameof(SendMessage), ConnectionStringSetting = "AzureSignalR")] SignalRInvocationContext invocationContext) { // Extract the message from the arguments var content = invocationContext.Arguments?.Length > 0 ? invocationContext.Arguments[0]?.ToString() : "(no content)"; logger.LogInformation($"SignalR Message received: {content}"); }}
using Microsoft.Azure.Functions.Worker;using Microsoft.Azure.Functions.Worker.Http;using Microsoft.Extensions.Logging;namespace HueCue.API;public class Api(ILogger<Api> logger){ private const string HubName = "ChatRoom"; [Function("negotiate")] public string Negotiate( [HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req, [SignalRConnectionInfoInput(HubName = HubName, ConnectionStringSetting = "AzureSignalR")] string connectionInfo) { logger.LogInformation($"SignalR Connection data requested: {connectionInfo}"); return connectionInfo; } [Function(nameof(SendMessage))] public void SendMessage( [SignalRTrigger(HubName,"messages", nameof(SendMessage), ConnectionStringSetting = "AzureSignalR")] SignalRInvocationContext invocationContext) { // Extract the message from the arguments var content = invocationContext.Arguments?.Length > 0 ? invocationContext.Arguments[0]?.ToString() : "(no content)"; logger.LogInformation($"SignalR Message received: {content}"); }}