internal NamedConnection Run(NetworkConnection connection) { MqttCommand command = _reader.Read(connection); if (command.CommandMessage != Types.CommandMessage.CONNECT) { throw new ProtocolException(command.CommandMessage, "Expected CONNECT"); } Connect connect = (Connect)command; _writer.Send(connection, new ConnAck()); return(new NamedConnection(connect.ClientIdentifier, connection)); }
public Task Send(MqttCommand command) { var tcs = new TaskCompletionSource <object>(); try { _writer.Send(_connection, command); tcs.SetResult(null); } catch (Exception ex) { tcs.SetException(ex); } return(tcs.Task); }
public Task Send(MqttCommand command) { return(_writer.Send(_connection, command)); }