Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

381
Views
Enviar mensajes SignalR simultáneos con una conexión

¿Cómo puedo enviar múltiples mensajes de SignalR en paralelo con una sola conexión?

Tengo el siguiente método hub:

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

En mi cliente tengo la siguiente conexión:

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

Estoy llamando al método hub así:

 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); } }

Cuando llamo al método de prueba en mi cliente varias veces, el concentrador recibe los mensajes uno tras otro en lugar de todos a la vez.

registro del cliente:

inicio: lun 29 de noviembre de 2021 17:27:35 GMT+0100 (3)
parada: lun 29 de noviembre de 2021 17:27:36 GMT+0100
parada: lun 29 de noviembre de 2021 17:27:37 GMT+0100
parada: lun 29 de noviembre de 2021 17:27:38 GMT+0100

Registro del servidor:

Inicio: 29.11.2021 17:27:35
Parada: 29.11.2021 17:27:36
Inicio: 29.11.2021 17:27:36
Parada: 29.11.2021 17:27:37
Inicio: 29.11.2021 17:27:37
Parada: 29.11.2021 17:27:38

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Para permitir múltiples invocaciones paralelas por cliente, debe configurar la propiedad MaximumParallelInvocationsPerClient , así:

 builder.Services.AddSignalR(options => options.MaximumParallelInvocationsPerClient = 10);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!