-
Notifications
You must be signed in to change notification settings - Fork 77
Cheatsheet
// Check if the channel already exists.
const channels = await chatClient.queryChannels({
distinct: true,
members: ['vishal', 'neil'],
});
if (channels.length === 1) {
// Channel already exist
} else {
// Channel doesn't exist.
}client.setUser is a deprecated version of client.connectUser or setUser is precursor of connectUser. This change was introduced in 2.10.0 since connectUser better defines the job of this function.
client.setUser has been deprecated, so please use client.connectUser instead.
new StreamChat('api_key') always returns a new instance of chat client, while StreamChat.getInstance('api_key') gives you a singleton instance of the client. We HIGHLY RECOMMEND you to use singleton instance to avoid creating multiple instances websocket connections, which in turn increases your monthly active users, and that affects your billing amount. Especially with react hooks, its quite easy to fall into these issues
Please check our best practices guide for details.
-- more things coming