It is always better to close the connections whenever the chat function is not in use. This helps in preventing overage. The overage is calculated when concurrent connections / MAU / message count exceeds the plan. A common problem is the concurrent connections where users log in from different systems and leave the connections open. Remember, any active WebSocket connection counts to concurrent connection. So it is always better to terminate/disconnect the connection when not in use.
Here is the best practice -
Try to disconnect the client on each page load to avoid holding a reference to it on previous pages -
https://getstream.io/chat/docs/logout/?language=js
A disconnect can be triggered by calling the below function -
JS -
client.disconnectUser()
Flutter -
client.disconnect()
iOS -
Client.shared.disconnect()
Android -
ChatClient.instance.disconnect()
Swift -
chatClient.connectionController().disconnect()
Comments
0 comments
Please sign in to leave a comment.