Open Closed

Use SignalR for catch messages #8015


User avatar
0
in4tek.abp created

Hi, we need to import the SignalR service to manage the messages of application. The connection run succesfully, but when I send a message, the Agular client don't show it. This is the client code:

  constructor(
    public readonly alarmService: MachineAlarmService,
    public readonly machineCommonService: MachineCommonCommandService,
    public sharedService: SharedService,
  ) {
    this.connection = new signalR.HubConnectionBuilder()
    .withUrl(`https://localhost:44351/signalr-hubs/chat`, {
      accessTokenFactory: () => this.oAuthService.getAccessToken(),
    })
    .build();

  this.connection.on('BroadcastMessage', this.handleMessage);

  this.connection
    .start()
    .then(() => {
      console.log('Connection started');
    })
    .catch(err => console.error(err.toString()));
  }

  handleMessage = (message: any) => {
    this.messageList.push(message);
    console.log('deneme');
    console.log(message);
  };
  • ABP Framework version: v7.1
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share a minimal reproducible project with me? i will check it.

    My email is shiwei.liang@volosoft.com

  • User Avatar
    0
    in4tek.abp created

    Hi, I sent the link to download the files with wetransfer. Thank you

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, I didn't get the email from wetransfer

  • User Avatar
    0
    in4tek.abp created

    Hi, try this please.

    https://we.tl/t-E---

Made with ❤️ on ABP v9.0.0-preview Updated on September 30, 2024, 13:13