Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

383
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda