Flutter 未收到 ABP signalR 通知

ABP signalR Notifications not received in Flutter

我正在尝试使用 signalR 从 abp 项目发送通知,它与 angular 一起工作正常,但是当我尝试在 flutter 中接收通知时,它不起作用!!没有收到通知 这是我的 flutter 代码

late HubConnection hubConnection ;
    
  @override
  void initState() {
    connect();
      super.initState();

  }
  void connect() async {
    hubConnection=  HubConnectionBuilder().withUrl(serverUrl, options: HttpConnectionOptions(
                accessTokenFactory: ()=>Api.getAccessToken())).build();
    hubConnection.start()?.then((value) => print('connected')); //prints connect successfully
    hubConnection.on('ReceiveNotificationMessage', (arguments) {
      print('notification');// doesn't print 
      print(arguments);// doesn't print 
    },);
  }

注意:我正在使用 signalr_netcore 包我也试过 signalr_client 包

提前致谢

我通过监听 onConnect 消息解决了这个问题,以便将用户添加到连接的客户端列表中,代码如下:

void connect() async {
    hubConnection.start()?.then((value) => print('connected'));
     hubConnection.on('OnConnectNotificationMessage', (arguments) {
      print('notification');
      print(arguments);
    },);
    hubConnection.on('ReceiveNotificationMessage',_newmessages);
  }