dotnet / dotnet/aspnetcore

Does @microsoft/signalr support react-native?

Open
#60,606 4 comments 0 reactions 0 assignees View on GitHub
area-signalr
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [ ] I have searched the existing issues

### Describe the bug

I'm trying to connect to signalr service from my react-native app using the `@microsoft/signalr` npm package v8.0.7

```ts
new HubConnectionBuilder()
.withUrl('wss://my_signalr_service', {
transport: HttpTransportType.WebSockets,
skipNegotiation: true,
})
.withAutomaticReconnect()
.configureLogging(LogLevel.Debug)
.build()
```

I've got the error from the `_resolveUrl` method of the `HttpConnection` class:

```
Cannot resolve wss://my_signalr_service
```

In the call stack I've found this line:

```ts
if (!Utils_1.Platform.isBrowser) {
throw new Error(`Cannot resolve '${url}'.`);
}
```

So, it looks like React Native is not supported at all?

### Expected Behavior

`@microsoft/signalr` connects to a service url from react-native app or it throws the explicit error that provides more information.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the _resolveUrl method in the HttpConnection class and the Utils.Platform.isBrowser check shown in the issue, then trace how @microsoft/signalr handles React Native URLs. Confirm whether React Native is supported; done means either a working connection path is covered or the unsupported case produces an explicit, informative error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.