Put IComm.WebSockets and Lua comm.ws_* behind #ifdef ENABLE_WEBSOCKETS

Not confident in the API shape, especially for ApiHawk
This commit is contained in:
YoshiRulz 2020-08-30 06:35:31 +10:00
parent c137252211
commit 3179dc8ebe
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 4 additions and 0 deletions

View File

@ -10,7 +10,9 @@ namespace BizHawk.Client.Common
SocketServer? Sockets { get; }
#if ENABLE_WEBSOCKETS
WebSocketServer? WebSockets { get; }
#endif
string? HttpTest();

View File

@ -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
}
}