Skip to content

Commit a9b2dde

Browse files
amingclawdevclaude
andcommitted
fix: add _getPort() to APIManager for WebSocket URL resolution
QA discovered webSocket.js referenced _getPort() which didn't exist, breaking all WebSocket connectivity. Added method to parse port from baseUrl. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f95fc9e commit a9b2dde

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

client/src/utils/api.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ class APIManager {
1818
return APIManager.instance;
1919
}
2020

21+
/**
22+
* Extract the port number from baseUrl (e.g. 'http://localhost:30001/api' -> 30001).
23+
* Falls back to 30001 if parsing fails.
24+
*/
25+
_getPort() {
26+
try {
27+
const url = new URL(this.baseUrl);
28+
return parseInt(url.port, 10) || 30001;
29+
} catch {
30+
return 30001;
31+
}
32+
}
33+
2134
_resolveCurrentLanguage() {
2235
if (typeof window === 'undefined') {
2336
return 'en';

0 commit comments

Comments
 (0)