private bool send(Fin fin, Opcode opcode, Mask mask, byte[] data, bool compressed) { lock (_forConn) { if (_readyState != WebSocketState.Open) { return(false); } return(writeBytes( WebSocketFrame.CreateWebSocketFrame(fin, opcode, mask, data, compressed).ToByteArray())); } }
private Task <bool> SendAsync(Fin fin, Opcode opcode, Mask mask, byte[] data, bool compressed) { lock (_forConn) { if (_readyState != WebSocketState.Open) { return(Task.FromResult(false)); } return(WriteBytesAsync( WebSocketFrame.CreateWebSocketFrame(fin, opcode, mask, data, compressed).ToByteArray())); } }