Locally it works perfectly, the message is camelcase.
{"type":1,"target":"questions","arguments":[[{"id":"1","text":"Test","columnId":"1"}]]}
But when I deploy the functions to Azure it's not working anymore.
{"type":1,"target":"questions","arguments":[[{"Id":"1","Text":"Test","ColumnId":"1"}]]}
I configured the Statup.cs as followed:
builder.Services.Configure<SignalROptions>(o => o.JsonObjectSerializer = new JsonObjectSerializer(
new JsonSerializerOptions()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
}));
EDIT:
The function call for the SignalR (where GetAllColumnsMapped just maps the DB result)
var payload = await GetAllColumnsMapped(tenantId, questions);
await signalRMessages.AddAsync(new SignalRMessage {Target = "columns", Arguments = new object[] {payload}});
I tried the following sample function code to send messages to SignalR using an Azure Function App.
Code :
Function1.cs :
Startup.cs :
SignalRMessagePayload.cs :
local.settings.json :
Postman output :
Output :
It ran successfully, as shown below.
I added the SignalR connection string to the Function App App settings in the Azure Portal as follows.
I successfully published my project to the function app, as shown below:
Azure Portal :
The function app ran successfully in the Azure Portal, as shown below.