Пример #1
0
 public byte[] EncodeFrame(TextFrame frame)
 {
     if (!string.IsNullOrEmpty(frame.Text))
     {
         var data = Encoding.UTF8.GetBytes(frame.Text);
         return(Encode(frame.OpCode, data, 0, data.Length, isMasked: frame.IsMasked));
     }
     else
     {
         return(Encode(frame.OpCode, EmptyArray, 0, 0, isMasked: frame.IsMasked));
     }
 }
Пример #2
0
 public byte[] EncodeFrame(TextFrame frame)
 {
     if (!string.IsNullOrEmpty(frame.Text))
     {
         var data = Encoding.UTF8.GetBytes(frame.Text);
         return Encode(frame.OpCode, data, 0, data.Length, isMasked: frame.IsMasked);
     }
     else
     {
         return Encode(frame.OpCode, EmptyArray, 0, 0, isMasked: frame.IsMasked);
     }
 }