From 93fc6b0cfcc6748429fa7db86aebd10ee79e3870 Mon Sep 17 00:00:00 2001 From: sebuh-infsol Date: Sat, 6 Jun 2026 18:42:56 -0700 Subject: [PATCH] fix: change SDK default WebSocket URL to production endpoint The SDK AppSession was defaulting to ws://localhost:8002/app-ws (local dev server) instead of the production endpoint. This caused third-party apps to fail connecting with 'Connection timeout after 5000ms' errors when deployed outside the local dev environment. Changed default from ws://localhost:8002/app-ws to wss://api.mentra.glass/app-ws in: - cloud/packages/sdk/src/app/session/index.ts - cloud/docs/api-reference/websocket/app-connection.mdx - docs/app-devs/reference/app-session.mdx --- cloud/docs/api-reference/websocket/app-connection.mdx | 2 +- cloud/packages/sdk/src/app/session/index.ts | 2 +- docs/app-devs/reference/app-session.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud/docs/api-reference/websocket/app-connection.mdx b/cloud/docs/api-reference/websocket/app-connection.mdx index cf670c3ed7..c5520017a3 100644 --- a/cloud/docs/api-reference/websocket/app-connection.mdx +++ b/cloud/docs/api-reference/websocket/app-connection.mdx @@ -14,7 +14,7 @@ wss://api.mentra.glass/app-ws wss://devapi.mentra.glass/app-ws ``` -```bash Local +```bash Local Development ws://localhost:8002/app-ws ``` diff --git a/cloud/packages/sdk/src/app/session/index.ts b/cloud/packages/sdk/src/app/session/index.ts index 7ddab2c3ba..9ef4cbb89c 100644 --- a/cloud/packages/sdk/src/app/session/index.ts +++ b/cloud/packages/sdk/src/app/session/index.ts @@ -256,7 +256,7 @@ export class AppSession { constructor(private config: AppSessionConfig) { // Set defaults and merge with provided config this.config = { - mentraOSWebsocketUrl: `ws://localhost:8002/app-ws`, // Use localhost as default + mentraOSWebsocketUrl: `wss://api.mentra.glass/app-ws`, // Production WebSocket URL autoReconnect: true, // Enable auto-reconnection by default for better reliability maxReconnectAttempts: 3, // Default to 3 reconnection attempts for better resilience reconnectDelay: 1000, // Start with 1 second delay (uses exponential backoff) diff --git a/docs/app-devs/reference/app-session.mdx b/docs/app-devs/reference/app-session.mdx index 1cb949a78d..064e848fa4 100644 --- a/docs/app-devs/reference/app-session.mdx +++ b/docs/app-devs/reference/app-session.mdx @@ -285,7 +285,7 @@ interface AppSessionConfig { /** Your API key for authentication. */ apiKey: string; - /** The WebSocket URL provided by MentraOS Cloud. Defaults to 'ws://localhost:8002/app-ws'. */ + /** The WebSocket URL provided by MentraOS Cloud. Defaults to 'wss://api.mentra.glass/app-ws. mentraOSWebsocketUrl?: string; /** Whether the session should automatically attempt to reconnect if the connection drops. Defaults to `false`. */