Better messaging and better rule implementation
All checks were successful
All checks were successful
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MauMau_Server.Websockets;
|
||||
|
||||
@@ -7,6 +8,7 @@ public class ConnectionInstance
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
[JsonIgnore]
|
||||
public WebSocket Socket { get; set; }
|
||||
|
||||
public ConnectionInstance(string name, Guid id, WebSocket socket)
|
||||
|
||||
@@ -16,6 +16,9 @@ public static class WebsocketManager
|
||||
|
||||
public static async void CloseAsync(WebSocket webSocket, WebSocketReceiveResult result)
|
||||
{
|
||||
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
|
||||
if (webSocket.State is WebSocketState.Open or WebSocketState.CloseReceived or WebSocketState.CloseSent)
|
||||
{
|
||||
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user