Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample Code Error: Empty Response in SignalRNegotiationFunctions.cs #2929

Open
runceel opened this issue Jan 21, 2025 · 0 comments
Open

Sample Code Error: Empty Response in SignalRNegotiationFunctions.cs #2929

runceel opened this issue Jan 21, 2025 · 0 comments

Comments

@runceel
Copy link

runceel commented Jan 21, 2025

In the following sample code, there seems to be a mistake. When I implemented and ran it, I received an empty response.
https://github.com/Azure/azure-functions-dotnet-worker/blob/main/samples/Extensions/SignalR/SignalRNegotiationFunctions.cs#L12-L20

I modified the sample to the following snippet, and it worked:

[Function(nameof(Negotiate))]
public static IActionResult Negotiate([HttpTrigger(AuthorizationLevel.Anonymous)] HttpRequest req,
    [SignalRConnectionInfoInput(HubName = "serverless")] string connectionInfo) =>
    // The serialization of the connection info object is done by the framework. It should be camel case. The SignalR client respects the camel case response only.
    new ContentResult { ContentType = "application/json", Content = connectionInfo };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant