Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Request-response model problem SignalR .Net Core #7371


User avatar
0
aprsystem created

I have SignalR Client Hub Connection and call InvokeAsynch method and server receives message in correct way. Then i return response and client hangs on InvokeAsync.

In Asp.Net Signalr (neither core nor abp) this manner works but there was CallAsync method in HubProxy instead InvokeAsync in HubConnection.

Client side:

public async Task<bool> EdytujObszar(int elementId, int obszar)
 {
      bool res = await Connection.InvokeAsync<bool>(EnumTools.GetDescription(MessageTypeEnum.EdytujObszar), elementId, obszar);
      return res;
 } 

Server side:

public class MyHub : OnlineClientHubBase, ITransientDependency, IMyHub
{
    private readonly IHubContext<MyHub> _hubContext;
    (...)

    public bool EdytujObszar(int elementId, int obszar)
    {
         bool result;
         (some logic)
         return result;
    }
    

I would like to receive response from server but InvokeAsync hangs forever. Using On method on client side to subscribe on message does not fulfil my expectations in this scenerio.


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
  • User Avatar
    0
    aprsystem created

    Error 404 when trying to open your URL.

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi @aprsystem, you need to login with your github account associated with your aspnetzero license to view url.

    you can do it at https://aspnetzero.com/LicenseManagement

  • User Avatar
    0
    aprsystem created

    Still does not work.

  • User Avatar
    0
    aprsystem created

    OK. I opened that page. But it is not anticipated approach. As i wrote:

    1. Client send message to server and wait for response (or not if is async)
    2. Server receives message, handle it and send response
    3. Client must receive message from server and receive method (same which sent) unlocks (or not if is async)

    Client must not wait for messages byc subscription approach.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @aprsystem

    Couldn't understand the problem, sorry.

    If you want to use something works asynchronous, you can use SignalR. If you want something synchronous, you can directly call an AppService method.