mirror of
https://github.com/Macro-Deck-App/Macro-Deck.git
synced 2026-05-06 21:51:04 +08:00
21 lines
535 B
C#
21 lines
535 B
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace MacroDeck.Server.Controllers;
|
|
|
|
public class WebSocketController : ControllerBase
|
|
{
|
|
[Route("/")]
|
|
[HttpGet]
|
|
public async Task<ActionResult> Get()
|
|
{
|
|
if (!HttpContext.WebSockets.IsWebSocketRequest)
|
|
{
|
|
return Redirect("client");
|
|
}
|
|
|
|
using var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync();
|
|
await WebSocketHandler.HandleWebSocket(webSocket);
|
|
return Ok();
|
|
}
|
|
} |