Open vsfeedback opened 3 days ago
hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(30);
Did you also change the ServerTimeout
on the client side?
Get logs so we can see why the connection disconnected: https://learn.microsoft.com/aspnet/core/signalr/diagnostics?view=aspnetcore-9.0
Hi @vsfeedback. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue has been moved from a ticket on Developer Community.
I was trying to connect front end and back end to the server, it was connected but when the web app in idle for 45 minutes it gets disconnected, i want my web app to not get disconnect to the SignalR hub, I tried lots of code and read lots of documentation but i cant fix that issue
this was the code i used in my backend server
Starup.CS
services.AddSignalR(hubOptions => { hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(30); });
app.MapHub<NotificationSignalrHub>(pattern: "/NotificationHub");
SignalRHub.CS
public async Task HandShakeToNotificationHub(UserConnection userConnection) { try { await Groups.AddToGroupAsync(Context.ConnectionId, GroupName);
}
public async Task SendMessage(string message) { try { var mar = getting the connection id from the Database; if (mar is not null) { await Clients.Group(GroupName).SendAsync("ReceiveNotification", message); } } catch (Exception ex) { throw; } }
please let me know what to do
Original Comments
Feedback Bot on 11/8/2024, 00:13 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.