/// <summary> /// Asynchronously send out message /// <seealso cref=""/> /// <see cref=""/> /// </summary> /// <param name="message">message to send</param> /// <permission cref="">This method can be called by: Every User</permission> /// <exception cref="StatusReadDeniedException"></exception> public async Task <int> SendAsync(CoapMessage message, ICoapEndpoint endpoint = null) { if (message.Id == 0) { message.Id = messageId++; } if (message.Type == CoapMessageType.Confirmable) { messageReponses.TryAdd(message.Id, new TaskCompletionSource <CoapMessage>()); } await transport.SendAsync(new CoapPayload { Payload = message.Serialise(), MessageId = message.Id, m_Endpoint = endpoint }); return(message.Id); }
public Task SendAsync(CoapPacket packet) => _coapEndpoint.SendAsync(packet);