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.
Maybe somebody can help me with:
- Why is it happening?
- How I should disconnect Client and Server
