diff --git a/plugin/index.ts b/plugin/index.ts index 68aa32a..2a66a23 100644 --- a/plugin/index.ts +++ b/plugin/index.ts @@ -212,7 +212,9 @@ export default { reject(new Error('Gateway connection timeout')); }, 15000); - const client = new (globalThis as any).WebSocket(gatewayUrl); + // Pass token via Authorization header in the upgrade request + const wsUrl = gwToken ? `${gatewayUrl}?token=${encodeURIComponent(gwToken)}` : gatewayUrl; + const client = new (globalThis as any).WebSocket(wsUrl); client.onerror = (err: any) => { clearTimeout(timeout);