fix: command center socket.io auto-detect host instead of hardcoded localhost#1470
fix: command center socket.io auto-detect host instead of hardcoded localhost#1470aphexcx wants to merge 1 commit intodimensionalOS:devfrom
Conversation
…ocalhost
Changes io("ws://localhost:7779") to io() which auto-detects the host
from the page URL. This fixes the command center when accessed remotely
(e.g. via NAT from a different machine), where localhost points to the
browser's machine instead of the server.
Rebuilt data/command_center.html with the fix.
Greptile SummaryThis PR fixes a one-line bug in the Command Center's Socket.IO connection setup that caused silent failures when the UI was accessed remotely (e.g., via NAT). The hardcoded Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant UvicornServer as Uvicorn Server (0.0.0.0:7779)
participant SocketIO as Socket.IO (same port)
Note over Browser,SocketIO: Before fix — remote access broken
Browser->>UvicornServer: GET http://10.x.x.x:7779/command-center
UvicornServer-->>Browser: command_center.html
Browser->>Browser: io("ws://localhost:7779")
Browser--xBrowser: connects to browser's own localhost (wrong host!)
Note over Browser,SocketIO: After fix — remote access works
Browser->>UvicornServer: GET http://10.x.x.x:7779/command-center
UvicornServer-->>Browser: command_center.html
Browser->>Browser: io() — auto-detects host from window.location
Browser->>SocketIO: ws://10.x.x.x:7779 (correct host)
SocketIO-->>Browser: full_state, costmap, robot_pose, path, …
Browser->>SocketIO: click, move_command, gps_goal, …
Last reviewed commit: 09707c2 |
| @@ -0,0 +1,129 @@ | |||
| <!DOCTYPE html> | |||
There was a problem hiding this comment.
Built artifact committed alongside LFS archive
data/command_center.html is now tracked as a plain git object (it is not in .gitattributes for LFS treatment), while data/.lfs/command_center.html.tar.gz is tracked via LFS. This creates two separate copies of the same generated file. Every future frontend rebuild will add a large (~137 KB) blob directly to the git history.
Since inline-html.js already creates and manages both outputs, consider adding data/command_center.html to .gitattributes for LFS tracking to avoid growing the regular git object store, or — if the plain file is needed for convenience — explicitly document that both copies must be kept in sync on every rebuild.
| @@ -0,0 +1,129 @@ | |||
| <!DOCTYPE html> | |||
| <html lang="en"> | |||
There was a problem hiding this comment.
@aphexcx delete this then should be quick merge
Problem
The command center's Socket.IO connection is hardcoded to
ws://localhost:7779inConnection.ts. When the command center is accessed remotely (e.g., via NAT from a different machine), the browser tries to connect back tolocalhost— which points to the browser's own machine, not the server. This silently breaks all command center functionality (costmap display, keyboard control, etc.).Fix
Changed
io("ws://localhost:7779")→io()inConnection.ts:22.io()with no arguments auto-detects the host from the page URL, which is the correct behavior for both:localhost:7779, connects tolocalhost:7779✓10.x.x.x:7779, connects to10.x.x.x:7779✓Rebuilt
data/command_center.htmlwith the fix.Files changed
dimos/web/command-center-extension/src/Connection.ts— one-line changedata/command_center.html— rebuiltdata/.lfs/command_center.html.tar.gz— rebuilt