mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
Check that WS connection is open before closing it on failed. Fixes #3346
Summary: Check that the WS state is set to OPEN before trying to close it when the ```websocketFailed``` event fires. Otherwise the app throws an error at the Android level. Fixes #3346 Closes https://github.com/facebook/react-native/pull/3347 Reviewed By: @svcscm Differential Revision: D2535807 Pulled By: @mkonicek fb-gh-sync-id: bb70c551ea2e582cfaa80139a265dbbca6d990d2
This commit is contained in:
parent
855f7be4b8
commit
45644aab35
@ -115,7 +115,7 @@ class WebSocket extends WebSocketBase {
|
|||||||
this.onerror && this.onerror(event);
|
this.onerror && this.onerror(event);
|
||||||
this.dispatchEvent(event);
|
this.dispatchEvent(event);
|
||||||
this._unregisterEvents();
|
this._unregisterEvents();
|
||||||
this._closeWebSocket(id);
|
this.readyState === this.OPEN && this._closeWebSocket(id);
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user