Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Websocket hang until network timeout when server side close the websocket gracefully #17861

Closed
favonianpine opened this issue Feb 5, 2018 · 2 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@favonianpine
Copy link

favonianpine commented Feb 5, 2018

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

NO

Environment

Steps to Reproduce

  1. Create a websocket server with node.js
  2. Use React native Android(0.48) to connect to the above websocket service
  3. After connected, server side call websocket.close() method to close the connection
  4. Android OkHttp(3.6) websocket Listener onclosing() method will be called as a response
  5. Android Okhttp onclose() will not be called until network timeout. Before this, react native could not know server side want to close the Websocket, but only wait.

Expected Behavior

React Native can implement a onclosing callback or call okhttp websocket close() method in onclosing() callback to get notified of this event.

@favonianpine favonianpine changed the title Android Websocket missed onclosing callback Android Websocket hang until network timeout when server side close the websocket gracefully Feb 5, 2018
@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 24, 2018
@favonianpine
Copy link
Author

Same as #18775
square/okhttp#3386

Root cause:

When I use okhttp to achieve WebSocket connection, when received onClosing (WebSocket webSocket, int code, String reason) callback, whether the call must be manually () method to close the resources.
See the source code found that if the client is passive disconnect, do not manually call the close () method will lead to onClosed (WebSocket webSocket, int code, String reason) method can not callback, the resources can not be recycled.

@facebook facebook locked as resolved and limited conversation to collaborators Feb 24, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants