sefidgaran / signalr_client

A Flutter SignalR Client for ASP.NET Core
https://pub.dev/packages/signalr_netcore
MIT License
71 stars 111 forks source link

To use Authorize #82

Closed cyberprophet closed 1 month ago

cyberprophet commented 6 months ago

If you want to use [Authorize], you can use IOWebSocketChannel instead of WebSocketChannel to pass Header.

_webSocket = IOWebSocketChannel.connect(Uri.parse(url), headers: {
      'Authorization':
          'Bearer ${_accessTokenFactory != null ? await _accessTokenFactory!() : ''}'
    });

It is also possible to transmit the entire header by slightly modifying the code in part lib/web_socket_transport.dart.

cyberprophet commented 6 months ago

If you want to use [Authorize], you can use IOWebSocketChannel instead of WebSocketChannel to pass Header.