dotnet / dotnet/aspnetcore

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

Open
#57,566 1 comment 0 reactions 0 assignees View on GitHub
area-signalr
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.