Problem: I encounter a "Unhandled Promise Rejection: Error: Connection closed" every time I attempt to use useChannel or usePresence. This is being done in a client component (app router), and the component is the child of a layout with AblyProvider.
This is the error I received.
I do know this is experimental, but I just wanted to make sure it isn't just me and the hooks are working just fine.
What I tried:
- Passing a client ID to the AblyProvider
- Passing a client ID to each instance of a useChannel or usePresence hook
- Using the provider in a layout
- Using the provider in a component that just wraps the client component I want to use the hooks in
- Cry a lot
So, I solved it myself. For those who come across this later:
It works if you create your own Ably client and pass it in to the provider.