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

128
Vistas
SingalR trying to connect after stop

I'm faced with a strange behavior with signalR. I use it only on one component (vue.js on my ui). When the user navigates to another page (I have spa application) in a destroyed event I'm trying to close the connection. I'm trying two options:

JS: connection.stop();
BE: i catch disconnect message in public override Task OnDisconnectedAsync method

or

JS: connection.invoke('Resource', params);
BE: await Groups.RemoveFromGroupAsync(Context.ConnectionId, "<group name>");

The connection is closed successfully but after some time (~15-20 seconds) the signalR is trying to connect to the server again (but the component is not existing in the elements block). After some time connection was restored but this component is not existing. If i refresh my spa page (with F5) signalR is not trying to connect, but if i open the component with signalR the situation is starting again.

Error in console

Maybe somebody can help me with:

  1. Why is it happening?
  2. How I should disconnect Client and Server
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found it. I've created an empty Disconnect handler and trying to catch the connections.

public override Task OnDisconnectedAsync(Exception? exception) { //breakpoint here; }

Some dev is added another SignalR hub on the application (e.g. another component on UI) and forgets to call close on component unload.

this.connection.stop()

So, don't forget to stop SignalR connections between UI and backend server.

about 4 years ago · Juan Pablo Isaza 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