Problem
- 'An admin is calling `queryChannels` to get a list of existing channels, and after that, a customer creates a new channel. At that point, I am expecting to see that new channel appear in that list of `queryChannels`. Is that expectation correct? '
This expectation is wrong - new channels will not be added to the list of channels returned from 'queryChannels'
- 'How to get updates when a new channel is created?'
It is not uncommon for an app to create 10k+ new channels or so per day. Listening for this many events would not be manageable. But there are a number of ways to address this if you are not at that kind of scale, but it would depend on the Use Case. One approach is to add your admin as a member to every new channel and listen fornotification.added_to_channel
.
const test = async () => {
await chatClient.connectUser({ id: "Admin" }, token);
await chatClient.connectUser({ id: "Customer" }, token);
chatClient.on("notification.added_to_channel", () => {
console.log("Admin was added as a member to a channel");
});
const channel = chatClient.channel("messaging", 'new-Channel', {
members: ["Admin", "Customer"]
});
await channel.watch();
return "complete";
};
Comments
0 comments
Please sign in to leave a comment.