Freezing Channels
Freezing a channel prevents users from sending new messages and adding or deleting reactions.
Sending a message to a frozen channel returns an error message. Attempting to add or delete reactions returns a 403 Not Allowed error.
User roles with the UseFrozenChannel permission can still use frozen channels normally. By default, no user role has this permission.
Freeze a Channel
let channelController = chatClient.channelController(for: .init(type: .messaging, id: "general"))
channelController.freezeChannel()let chat = chatClient.makeChat(for: .init(type: .messaging, id: "general"))
try await chat.freeze()Unfreeze a Channel
let channelController = chatClient.channelController(for: .init(type: .messaging, id: "general"))
channelController.unfreezeChannel()let chat = chatClient.makeChat(for: .init(type: .messaging, id: "general"))
try await chat.unfreeze()Granting the Frozen Channel Permission
Permissions are typically managed in the Stream Dashboard under your app's Roles & Permissions settings. This is the recommended approach for most use cases.
To grant permissions programmatically, update the channel type using a server-side API call. See user permissions for more details.
const channelType = await client.chat.getChannelType({ name: "messaging" });
const adminGrants = [...channelType.grants.admin, "use-frozen-channel"];
await client.chat.updateChannelType({
name: "messaging",
grants: { admin: adminGrants },
});