we are trying to send content from the client to server using azure functions signalR implementation. however the azure function SendToUser method is not being called.
client code:
//building connection
hubConnection = new HubConnectionBuilder().WithUrl("http://localhost:7071/api").Build();
//starting connection
await hubConnection.StartAsync();
//sending data
hubConnection.InvokeAsync("SendToUser", "message", "user");
server code:
[FunctionName("Negotiate")]
public static SignalRConnectionInfo Negotiate([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req, [SignalRConnectionInfo(HubName = "ChatHub")] SignalRConnectionInfo connectionInfo, ILogger log)
{
log.LogInformation($"connection {connectionInfo.Url} {connectionInfo.AccessToken}");
return connectionInfo;
}
[FunctionName("SendToUser")]
public void SendToUser([HttpTrigger(AuthorizationLevel.Anonymous, "post")] obj message, HttpRequest req, [SignalR(HubName = "ChatHub")] IAsyncCollector<SignalRMessage> signalRMessage, ILogger log)
{
log.LogInformation($"message sent by client");
}
is this the correct implementation for this ?