Skip to content

Commit

Permalink
Android: Close websocket properly when remote server initiates close (#…
Browse files Browse the repository at this point in the history
…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: #22248

Differential Revision: D13047556

Pulled By: hramos

fbshipit-source-id: c5c56ea8418cfdf734fb51f863b3066856de6512
  • Loading branch information
syaau authored and facebook-github-bot committed Nov 14, 2018
1 parent 339d9d3 commit 2e465bc
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public void onOpen(WebSocket webSocket, Response response) {
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();
Expand Down

0 comments on commit 2e465bc

Please sign in to comment.