public static async Task SendMessageAsync(this WebSocket s, Message m, CancellationToken token = default) { await s.SendAsync(m.AsSegment(), WebSocketMessageType.Binary, true, token).ConfigureAwait(false); }
internal static ArraySegment <byte> AsSegment(this Message message) { MemoryMarshal.TryGetArray <byte>(message, out var segment); return(segment); }