Skip to content

Commit d4e9540

Browse files
committed
Fix relay server auto-upgrade bugs and reconnection issues
- Add auto-reconnection logic for remote handlers when connection is lost - Add protocol fallback (HTTP/HTTPS) in health checks for better auto-upgrade support - Throw error when server readiness check times out after max retries - Check isIntentionalDisconnect flag before creating WebSocket to prevent race condition - Apply formatting changes from oxfmt
1 parent 65cff04 commit d4e9540

File tree

2 files changed

+226
-179
lines changed

2 files changed

+226
-179
lines changed

packages/relay/src/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export const createRelayClient = (
134134
return;
135135
}
136136
}
137+
138+
throw new Error("Server upgrade timed out after maximum retries");
137139
};
138140

139141
const connect = (): Promise<void> => {
@@ -150,6 +152,10 @@ export const createRelayClient = (
150152
pendingConnectionPromise = (async () => {
151153
await ensureServerReady();
152154

155+
if (isIntentionalDisconnect) {
156+
throw new Error("Connection aborted");
157+
}
158+
153159
return new Promise<void>((resolve, reject) => {
154160
pendingConnectionReject = reject;
155161
const connectionUrl = token

0 commit comments

Comments
 (0)