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


9 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---

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I could not build the solution.

    image.png

  • User Avatar
    0
    in4tek.abp created

    Hi,
    sorry... try to exclude DevExpress reference; it's a thirdpart software, but isn't necessary for the test. We used it to other funcionality

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Sorry, I'm confused.

    You defined a method on the angular side but never called it from the back end.

    image.png

    You can check this https://medium.com/@gabrielbastosdeveloper/real-time-application-development-with-signalr-and-angular-74c7d869afaf

  • User Avatar
    0
    in4tek.abp created

    HI,
    we solved it, thanks for the support!

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    good : )

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on June 13, 2025, 11:37