'宣言 Public Property WebSocketFactory As WebSocketFactory
public WebSocketFactory WebSocketFactory {get; set;}
'宣言 Public Property WebSocketFactory As WebSocketFactory
public WebSocketFactory WebSocketFactory {get; set;}
WebSocketFactory = async (uri) => { var client = SystemClientWebSocket.CreateClientWebSocket(); if (client is System.Net.WebSockets.Managed.ClientWebSocket managed) { managed.Options.KeepAliveInterval = TimeSpan.FromSeconds(0); await managed.ConnectAsync(uri, default); } else { var coreSocket = client as ClientWebSocket; coreSocket.Options.KeepAliveInterval = TimeSpan.FromSeconds(0); await coreSocket.ConnectAsync(uri, default); } return client; }