Skip to content

Does @microsoft/signalr support react-native? #60606

Open
@SergeyAlexeev

Description

@SergeyAlexeev

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

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions