Skip to content

Commit 3127ce1

Browse files
yzarubinide
authored andcommitted
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 #3347 Reviewed By: @​svcscm Differential Revision: D2535807 Pulled By: @mkonicek fb-gh-sync-id: bb70c551ea2e582cfaa80139a265dbbca6d990d2
1 parent 1aa2cc4 commit 3127ce1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Libraries/WebSocket/WebSocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class WebSocket extends WebSocketBase {
115115
this.onerror && this.onerror(event);
116116
this.dispatchEvent(event);
117117
this._unregisterEvents();
118-
this._closeWebSocket(id);
118+
this.readyState === this.OPEN && this._closeWebSocket(id);
119119
})
120120
];
121121
}

0 commit comments

Comments
 (0)