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

130
Visualizações
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 Respostas
Responde à pergunta

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 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