Skip to content

When receive onClosing () callback, Should I must manually call close () method to close the resources?  #3386

Description

@lixingmao

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. The actual situation is indeed the case Happening.
If it is necessary, should it be emphasized in the document or comment?

Activity

  1. swankjesse commented on Jun 10, 2017

    @swankjesse
    Collaborator

    You must call either close or cancel on every WebSocket you create. We should add this to our documentation.

  2. added a commit that references this issue on Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions