Skip to content

How to close a channel when there is no network? #2147

@michalzaq12

Description

@michalzaq12

Ably 2.3.2

How do I close a channel when there's no network? (The channel is no longer needed, and the client's presence should also be removed).
I don't see any pattern for gracefully closing a channel in your documentation.

My code currently looks like this:

channel.detach()
   .finally(() => connection.release(<channelName>))

When there is no network:

  1. detach() fails with: _ErrorInfo: Connection to server unavailable
  2. release() fails with: Can only release a channel in a state where there is no possibility of further updates from the server being received (initialized, detached, or failed); was suspended

Problems:
Once the network returns, the channel will re-attched and presence will be re-entered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions