Android: Close websocket properly when remote server initiates close (#22248)

Summary:
When the remote server closes the websocket, the app doesn't get a 'close' event in Android, There is no issue on iOS.
Pull Request resolved: https://github.com/facebook/react-native/pull/22248

Differential Revision: D13047556

Pulled By: hramos

fbshipit-source-id: c5c56ea8418cfdf734fb51f863b3066856de6512
This commit is contained in:
Ranjan Shrestha 2018-11-13 23:17:25 -08:00 коммит произвёл Facebook Github Bot
Родитель 339d9d3afb
Коммит 2e465bca15
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -147,6 +147,11 @@ public final class WebSocketModule extends ReactContextBaseJavaModule {
sendEvent("websocketOpen", params);
}
@Override
public void onClosing(WebSocket websocket, int code, String reason) {
websocket.close(code, reason);
}
@Override
public void onClosed(WebSocket webSocket, int code, String reason) {
WritableMap params = Arguments.createMap();