mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Adjust class name to ObjectType
This commit is contained in:
parent
57dbc79949
commit
ad34d6185b
2 changed files with 7 additions and 7 deletions
|
@ -18,7 +18,7 @@ public class HTTP : IPlugin
|
||||||
private static IGame _game;
|
private static IGame _game;
|
||||||
private static HttpClient _httpClient;
|
private static HttpClient _httpClient;
|
||||||
private static long _requestId;
|
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}";
|
public static readonly string UserAgent = $"Capy64/{Capy64.Version}";
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public class HTTP : IPlugin
|
||||||
|
|
||||||
await task;
|
await task;
|
||||||
|
|
||||||
var handle = new WebSocketHandle(wsClient, requestId);
|
var handle = new WebSocketClient(wsClient, requestId);
|
||||||
WebSocketConnections.Add(handle);
|
WebSocketConnections.Add(handle);
|
||||||
|
|
||||||
_game.LuaRuntime.QueueEvent("websocket_connect", LK =>
|
_game.LuaRuntime.QueueEvent("websocket_connect", LK =>
|
||||||
|
|
|
@ -7,12 +7,12 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Capy64.Runtime.Objects.Handlers;
|
namespace Capy64.Runtime.Objects.Handlers;
|
||||||
|
|
||||||
public class WebSocketHandle
|
public class WebSocketClient
|
||||||
{
|
{
|
||||||
public const string ObjectType = "WebSocketClient";
|
public const string ObjectType = "WebSocketClient";
|
||||||
private readonly ClientWebSocket _socket;
|
private readonly ClientWebSocket _socket;
|
||||||
private readonly long _requestId;
|
private readonly long _requestId;
|
||||||
public WebSocketHandle(ClientWebSocket socket, long requestId)
|
public WebSocketClient(ClientWebSocket socket, long requestId)
|
||||||
{
|
{
|
||||||
_socket = socket;
|
_socket = socket;
|
||||||
_requestId = requestId;
|
_requestId = requestId;
|
||||||
|
@ -57,7 +57,7 @@ public class WebSocketHandle
|
||||||
{
|
{
|
||||||
var L = Lua.FromIntPtr(state);
|
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);
|
L.PushInteger(client._requestId);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class WebSocketHandle
|
||||||
{
|
{
|
||||||
var L = Lua.FromIntPtr(state);
|
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);
|
var data = L.CheckBuffer(2);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class WebSocketHandle
|
||||||
{
|
{
|
||||||
var L = Lua.FromIntPtr(state);
|
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)
|
if (client is null || client._socket.State == WebSocketState.Closed)
|
||||||
return 0;
|
return 0;
|
Loading…
Reference in a new issue