Cleanup
This commit is contained in:
@@ -27,23 +27,21 @@ public class RoomController : ControllerBase
|
||||
[HttpGet("{id}")]
|
||||
public async Task ConnectToRoom(string id)
|
||||
{
|
||||
if (HttpContext.WebSockets.IsWebSocketRequest)
|
||||
{
|
||||
if (_roomManager.RoomExists(id))
|
||||
{
|
||||
using var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync();
|
||||
var room = _roomManager.GetRoom(id);
|
||||
await room.InstantiateConnection(webSocket);
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpContext.Response.StatusCode = 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!HttpContext.WebSockets.IsWebSocketRequest)
|
||||
{
|
||||
HttpContext.Response.StatusCode = 400;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_roomManager.RoomExists(id))
|
||||
{
|
||||
HttpContext.Response.StatusCode = 404;
|
||||
return;
|
||||
}
|
||||
|
||||
using var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync();
|
||||
var room = _roomManager.GetRoom(id);
|
||||
await room.InstantiateConnection(webSocket);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
Reference in New Issue
Block a user