Skip to content

Commit edf7b75

Browse files
committed
fix: allow websocket to reuse the address so it can reconnect after the domain reload
1 parent 71e4841 commit edf7b75

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,5 @@ log.txt
120120
log.txt.meta
121121
Server~/build/*
122122
Server~/node_modules/*
123+
.bmad-core/
124+
.windsurf/

Editor/UnityBridge/McpUnityEditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private void DrawServerTab()
175175
mcpUnityServer.StopServer();
176176
}
177177

178-
Repaint();
178+
//Repaint();
179179

180180
GUI.enabled = true;
181181
EditorGUILayout.EndHorizontal();

Editor/UnityBridge/McpUnityServer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public void StartServer()
127127
{
128128
var host = McpUnitySettings.Instance.AllowRemoteConnections ? "0.0.0.0" : "localhost";
129129
_webSocketServer = new WebSocketServer($"ws://{host}:{McpUnitySettings.Instance.Port}");
130+
_webSocketServer.ReuseAddress = true;
130131
_webSocketServer.AddWebSocketService("/McpUnity", () => new McpUnitySocketHandler(this));
131132
_webSocketServer.Start();
132133
McpLogger.LogInfo($"WebSocket server started successfully on {host}:{McpUnitySettings.Instance.Port}.");

0 commit comments

Comments
 (0)