Adjust class name to ObjectType

This commit is contained in:
Alessandro Proto 2023-01-28 19:37:13 +01:00
parent 57dbc79949
commit ad34d6185b
2 changed files with 7 additions and 7 deletions

View file

@ -18,7 +18,7 @@ public class HTTP : IPlugin
private static IGame _game;
private static HttpClient _httpClient;
private static long _requestId;
public static readonly HashSet<WebSocketHandle> WebSocketConnections = new();
public static readonly HashSet<WebSocketClient> WebSocketConnections = new();
public static readonly string UserAgent = $"Capy64/{Capy64.Version}";
@ -332,7 +332,7 @@ public class HTTP : IPlugin
await task;
var handle = new WebSocketHandle(wsClient, requestId);
var handle = new WebSocketClient(wsClient, requestId);
WebSocketConnections.Add(handle);
_game.LuaRuntime.QueueEvent("websocket_connect", LK =>

View file

@ -7,12 +7,12 @@ using System.Threading;
namespace Capy64.Runtime.Objects.Handlers;
public class WebSocketHandle
public class WebSocketClient
{
public const string ObjectType = "WebSocketClient";
private readonly ClientWebSocket _socket;
private readonly long _requestId;
public WebSocketHandle(ClientWebSocket socket, long requestId)
public WebSocketClient(ClientWebSocket socket, long requestId)
{
_socket = socket;
_requestId = requestId;
@ -57,7 +57,7 @@ public class WebSocketHandle
{
var L = Lua.FromIntPtr(state);
var client = L.CheckObject<WebSocketHandle>(1, ObjectType, false);
var client = L.CheckObject<WebSocketClient>(1, ObjectType, false);
L.PushInteger(client._requestId);
@ -68,7 +68,7 @@ public class WebSocketHandle
{
var L = Lua.FromIntPtr(state);
var client = L.CheckObject<WebSocketHandle>(1, ObjectType, false);
var client = L.CheckObject<WebSocketClient>(1, ObjectType, false);
var data = L.CheckBuffer(2);
@ -84,7 +84,7 @@ public class WebSocketHandle
{
var L = Lua.FromIntPtr(state);
var client = L.CheckObject<WebSocketHandle>(1, ObjectType, true);
var client = L.CheckObject<WebSocketClient>(1, ObjectType, true);
if (client is null || client._socket.State == WebSocketState.Closed)
return 0;