Async Action Example
seikosantana opened this issue · comments
Hi, i currently have this implementation of the controller:
[MqttController]
[MqttRoute("telemetry")]
public class DeviceTelemetryController: MqttBaseController
{
public Task NewTelemetry()
{
return BadMessage();
}
}
My question is, how to make the Action async?
Thanks in advance
Seeing https://github.com/IoTSharp/IoTSharp/blob/64f2dbcc10f95a434b5186b63beffb57dd7b38f7/IoTSharp/Services/MQTTControllers/AttributesController.cs#L168-L250 does that mean we don't actually have to return
any of Ok
, Accepted
, or BadMessage
?
I'm struggling with how to return data using methods like Ok().
I tried changing the return type to Task<Task>
and it can't be invoked.
Seems like the only way to do async
with Ok()
probably is by await Ok()
and then return
.
return Task.CompletedTask;
yes but that is not asynchronous and it doens't make use of Ok()
and the others
I think it is possible to do like in the README of #6