Error code: 90001 - Channel operation failed (invalid channel state)

Why do you see this error:

You may see this error if you are trying to perform an operation on a channel that is in a state that does not permit that operation, such as attempting to attach when the channel state is failed

 

How can you resolve this error:

You can resolve this error by making sure that the channel is in an appropriate state before performing operations on it. Ably's client libraries allow you to listen for channel state changes: https://ably.com/docs/channels#listen-for-state; using this, you can simply add the implementation of the operation you want to perform in state change callbacks.