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