初始化

This commit is contained in:
2025-12-11 14:04:39 +08:00
commit 1f65bbf628
2676 changed files with 838983 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MQTTnet.Server;
namespace iotweb.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class ValuesController : ControllerBase
{
private readonly MqttServer _mqttServer;
public ValuesController(MqttServer mqttServer)
{
_mqttServer = mqttServer;
}
[HttpGet()]
public async Task<IActionResult> GetConnectedClients()
{
var clients = await _mqttServer.GetClientsAsync();
return Ok(clients.Select(c => new
{
Id = c.Id,
Endpoint = c.Endpoint
}));
}
}
}