'Work with ASP.NET SignalR in React Native

Actually, I wanna to build chat app with ASP.NET and SignalR in React Native.

My backend API comes from ASP.NET Without change server from ASP.NET to ASP.NET Core, is it possible to work with SignalR in React Native?

I have tested @aspnet/signalr and it is not compatible with ASP.NET and also I tested signalr and it requires jQuery on React Native!! (I think it is just for ReactJS, not React-native)



Solution 1:[1]

You can try this on React or React Native.

Use the official SignalR package @microsoft/signalr

const connection = new HubConnectionBuilder()
    .withUrl("https://LinkOfTheEndPoin", {
      accessTokenFactory: () => 'JWT_TOKEN_HERE',
    })
    .withAutomaticReconnect()
    .configureLogging(LogLevel.Information)
    .build();

  connection.start();

"LogLevel.Information" will help you to understand what's going on the background!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohaimenul Islam Joy