Fix can not reconnect websocket after turn off then turn on wifi. Thi… (#7552)
* Fix can not reconnect websocket after turn off then turn on wifi. This bug happen on some Samsung device (s10+, s20fe,...) * Fix can not reconnect websocket after turn off then turn on wifi. This bug happen on some Samsung device (s10+, s20fe,...) * Fix can not reconnect websocket after turn off then turn on wifi. This bug happen on some Samsung device (s10+, s20fe,...)
This commit is contained in:
parent
28dc688fc3
commit
0072d6a52e
1 changed files with 8 additions and 0 deletions
|
|
@ -136,6 +136,14 @@ export default class WebSocketClient {
|
|||
|
||||
// Check again if the client is the same, to avoid race conditions
|
||||
if (this.conn === client) {
|
||||
// In case turning on/off Wi-fi on Samsung devices
|
||||
// the websocket will call onClose then onError then initialize again with readyState CLOSED, we need to open it again
|
||||
if (this.conn.readyState === WebSocketReadyState.CLOSED) {
|
||||
if (this.connectionTimeout) {
|
||||
clearTimeout(this.connectionTimeout);
|
||||
}
|
||||
this.conn.open();
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.conn = client;
|
||||
|
|
|
|||
Loading…
Reference in a new issue