Сервер настроен следующим образом: < /p>
Код: Выделить всё
var webSocketOptions = new WebSocketOptions()
{
KeepAliveInterval = TimeSpan.FromSeconds(120),
};
app.UseWebSockets(webSocketOptions);
app.Use(async (context, next) =>
{
if (context.Request.Path == "/ws")
{
if (context.WebSockets.IsWebSocketRequest)
{
using (var WS = await context.WebSockets.AcceptWebSocketAsync())
{
// do some stuff or even nothing
} //
Подробнее здесь: [url]https://stackoverflow.com/questions/66165250/how-to-preserve-a-websocket-connection-on-asp-net-core[/url]
Мобильная версия