fix: group-chat agent client use dynamic port instead of hardcoded 8648 (#539)
The connect() method defaulted to port 8648, causing websocket connection refused errors when the server was started with a custom port via `hermes-web-ui start <port>` or PORT env var. Now reads from process.env.PORT. Closes #536 Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -91,10 +91,11 @@ class AgentClient {
|
|||||||
this.storage = storage
|
this.storage = storage
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect(port = 8648): Promise<void> {
|
async connect(port?: number): Promise<void> {
|
||||||
|
const actualPort = port ?? parseInt(process.env.PORT || '8648', 10)
|
||||||
const token = await getToken()
|
const token = await getToken()
|
||||||
|
|
||||||
this.socket = io(`http://127.0.0.1:${port}/group-chat`, {
|
this.socket = io(`http://127.0.0.1:${actualPort}/group-chat`, {
|
||||||
auth: {
|
auth: {
|
||||||
token: token || undefined,
|
token: token || undefined,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user