Function useChatConnection

A hook that provides the current connection status and error, and allows the user to listen to connection status changes.