private static Task SendAsync(WebSocket webSocket, ArraySegment <byte> messageSegment, WebSocketMessageType messageType, bool compressed, bool endOfMessage, CancellationToken cancellationToken) { if (compressed) { CompressionWebSocket compressionWebSocket = (webSocket as CompressionWebSocket) ?? throw new InvalidOperationException($"In order to send compressed message the used {nameof(WebSocket)} implementation must be {nameof(CompressionWebSocket)}."); return(compressionWebSocket.SendAsync(messageSegment, messageType, true, endOfMessage, cancellationToken)); } else { return(webSocket.SendAsync(messageSegment, messageType, endOfMessage, cancellationToken)); } }
public Task SendAsync_SingleMessage_SingleWebSocket() { return(_singleWebSocket.SendAsync(_message, WebSocketMessageType.Text, true, CancellationToken.None)); }