Skip to content

Commit 1b08a77

Browse files
authored
Revert "Safari: ensure ws reconnect on reopen" (#27946)
1 parent 867001a commit 1b08a77

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

assets/js/views/App.vue

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export default defineComponent({
5757
data: () => {
5858
return {
5959
reconnectTimeout: null as number | null,
60-
dataTimeout: null as number | null,
6160
ws: null as WebSocket | null,
6261
authNotConfigured: false,
6362
};
@@ -149,10 +148,6 @@ export default defineComponent({
149148
}, 2500);
150149
},
151150
disconnect() {
152-
if (this.dataTimeout) {
153-
window.clearTimeout(this.dataTimeout);
154-
this.dataTimeout = null;
155-
}
156151
if (this.ws) {
157152
this.ws.onerror = null;
158153
this.ws.onopen = null;
@@ -194,21 +189,13 @@ export default defineComponent({
194189
};
195190
this.ws.onopen = () => {
196191
console.log("websocket connected");
192+
window.app.setOnline();
197193
};
198194
this.ws.onclose = () => {
199-
if (this.dataTimeout) {
200-
window.clearTimeout(this.dataTimeout);
201-
this.dataTimeout = null;
202-
}
203195
window.app.setOffline();
204196
this.reconnect();
205197
};
206198
this.ws.onmessage = (evt) => {
207-
if (this.dataTimeout) {
208-
window.clearTimeout(this.dataTimeout);
209-
this.dataTimeout = null;
210-
}
211-
window.app.setOnline();
212199
try {
213200
const msg = JSON.parse(evt.data);
214201
if (msg.startupCompleted) {
@@ -223,15 +210,6 @@ export default defineComponent({
223210
});
224211
}
225212
};
226-
227-
// Safari/iOS 26 may fail WS handshake or open without delivering data.
228-
// Safari/iOS 26 may fail WS handshake or open without delivering data.
229-
// If no message received within 10s, tear down and retry.
230-
this.dataTimeout = window.setTimeout(() => {
231-
console.log("websocket data timeout, reconnecting");
232-
this.dataTimeout = null;
233-
this.ws?.close();
234-
}, 10000);
235213
},
236214
reload() {
237215
window.location.reload();

0 commit comments

Comments
 (0)