private void SendCommand(MessageBase message) { var raw = JsonSerializer.SerializeToUtf8Bytes(message, message.GetType()); var output = new byte[raw.Length + 1]; Array.Copy(raw, 0, output, 1, raw.Length); output[0] = message.OpCode; _client.SendAsync(output); AddLog("Sent " + output.Length + " bytes for OpCode " + message.OpCode); this._client.ReceiveAsync(); }