Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

385
Visualizações
Send concurrent SignalR messages with one connection

How can I send multple SignalR messages in parallel with only one connection?

I have the following hub method:

public async Task Test()  
{  
    Console.WriteLine($"Start: {DateTime.Now}");  
    await Task.Run(() => Task.Delay(1000));  
    Console.WriteLine($"Stop: {DateTime.Now}");  
} 

In my client I have the following connection:

private connection: HubConnection = new HubConnectionBuilder()
  .withUrl(this.url)
  .configureLogging(LogLevel.Information)
  .withAutomaticReconnect([1000, 2000, 3000, 4000, 5000])
  .build();

I'm calling the hub method like this:

async test(): Promise<void> {
  try {
    console.log('start: ' + new Date().toString());
    await this.connection.invoke('Test');
    console.log('stop: ' + new Date().toString());
  } catch (err) {
    console.error(err);
  }
}

When I call the test method in my client multiple times, the hub is receiving the messages one after the other instead of all at once.

Client log:

start: Mon Nov 29 2021 17:27:35 GMT+0100 (3)
stop: Mon Nov 29 2021 17:27:36 GMT+0100
stop: Mon Nov 29 2021 17:27:37 GMT+0100
stop: Mon Nov 29 2021 17:27:38 GMT+0100

Server log:

Start: 29.11.2021 17:27:35
Stop: 29.11.2021 17:27:36
Start: 29.11.2021 17:27:36
Stop: 29.11.2021 17:27:37
Start: 29.11.2021 17:27:37
Stop: 29.11.2021 17:27:38

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In order to allow multiple parallel invocations per client, you need to set the MaximumParallelInvocationsPerClient property, like this:

builder.Services.AddSignalR(options => options.MaximumParallelInvocationsPerClient = 10);
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda