From 3179dc8ebec78e98ad1048ea5f141e4e8f2f8b7b Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 30 Aug 2020 06:35:31 +1000 Subject: [PATCH] Put IComm.WebSockets and Lua comm.ws_* behind #ifdef ENABLE_WEBSOCKETS Not confident in the API shape, especially for ApiHawk --- src/BizHawk.Client.Common/Api/Interfaces/ICommApi.cs | 2 ++ src/BizHawk.Client.Common/lua/CommonLibs/CommLuaLibrary.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/BizHawk.Client.Common/Api/Interfaces/ICommApi.cs b/src/BizHawk.Client.Common/Api/Interfaces/ICommApi.cs index 6dab4d8ad7..3f30af1f5b 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/ICommApi.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/ICommApi.cs @@ -10,7 +10,9 @@ namespace BizHawk.Client.Common SocketServer? Sockets { get; } +#if ENABLE_WEBSOCKETS WebSocketServer? WebSockets { get; } +#endif string? HttpTest(); diff --git a/src/BizHawk.Client.Common/lua/CommonLibs/CommLuaLibrary.cs b/src/BizHawk.Client.Common/lua/CommonLibs/CommLuaLibrary.cs index eb8ce1f214..4381067ea8 100644 --- a/src/BizHawk.Client.Common/lua/CommonLibs/CommLuaLibrary.cs +++ b/src/BizHawk.Client.Common/lua/CommonLibs/CommLuaLibrary.cs @@ -247,6 +247,7 @@ namespace BizHawk.Client.Common } } +#if ENABLE_WEBSOCKETS [LuaMethod("ws_open", "Opens a websocket and returns the id so that it can be retrieved later.")] [LuaMethodExample("local ws_id = comm.ws_open(\"wss://echo.websocket.org\");")] public string WebSocketOpen(string uri) @@ -287,5 +288,6 @@ namespace BizHawk.Client.Common { if (_websockets.TryGetValue(Guid.Parse(guid), out var wrapper)) wrapper.Close(status, closeMessage); } +#endif } } \ No newline at end of file