Skip to content

Discrepancy between SignalRConnectionInfo & object that is needed for the @microsoft/signalr lib #57566

@Swouterke

Description

@Swouterke

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When using a functionApp to set up a SignalR connection with a frontend, we get a SignalRConnectionInfo object from the SignalRConnectionInfoInput attribute on the function:

public sealed class SignalRConnectionInfo { public string Url { get; set; } public string AccessToken { get; set; } }

When the @microsoft/signalr lib uses this object to start the connection, an error is thrown:

Error: Failed to start the connection: Error: None of the transports supported by the client are supported by the server.

When changing the return object of the negotiate to have lowerCase properties, e.g. url and accessToken and send it to the client like that, the connection is started successfully.

Expected Behavior

The client lib should work with UpperCase properties

Steps To Reproduce

FunctionApp function:
[Function(nameof(Negotiate))] public SignalRConnectionInfo Negotiate( [HttpTrigger(AuthorizationLevel.Anonymous)] HttpRequest req, [SignalRConnectionInfoInput(HubName = _signalRHubName)] SignalRConnectionInfo connectionInfo) { return connectionInfo; }

client (React):
const connection = new HubConnectionBuilder() .withUrl(url, { accessTokenFactory: fetchServiceToken, }) .configureLogging(LogLevel.Information) .withAutomaticReconnect() .build(); await connection.start();

Exceptions (if any)

No response

.NET Version

8.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions