Skip to content

Commit 772aa97

Browse files
[#78775] Add WebSocket server mode
1 parent 2175b08 commit 772aa97

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Renode/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ This circular dependency seems to be a problem.
4545
*/
4646
Core.EmulationManager.RebuildInstance();
4747

48+
#if NET
49+
if(options.ServerMode)
50+
{
51+
if(!WebSockets.WebSocketsManager.Instance.Start(options.ServerModePort))
52+
{
53+
string reason = options.ServerModePort != 21234 ? $"specified port ({options.ServerModePort}) is unavailable" : "port range (21234 - 31234) is unavailable";
54+
Console.Out.WriteLine($"[ERROR] Couldn't launch server - {reason}");
55+
return;
56+
}
57+
58+
Emulator.BeforeExit += WebSockets.WebSocketsManager.Instance.Dispose;
59+
}
60+
#endif
61+
4862
var thread = new Thread(() =>
4963
{
5064
try

0 commit comments

Comments
 (0)