Channel Best Practices
Resubscribe when world assignment changes
A user's world assignment determines what channels they have access to. Before a user's world assignment changes, your application should unsubscribe the user from channels and resubscribe them to the same channels afterward.
To learn how to subscribe and unsubscribe users, read Subscribing users.
Keep messages small
Avoid sending large messages over push channels. Start with no subscriptions and add them only when you find you need to react to specific events.
Be especially cautious with vault-related channels: messages about vault changes include the entire vault content, and there is a byte limit — content that exceeds it will be silently truncated. To avoid this, scope vaults to the smallest possible volume of data and split data across multiple vaults when appropriate.
Prefer operating on entities over publishing directly
Publishing messages to channels directly from client code is not recommended. The preferred pattern is to operate on Epicenter entities and let Epicenter send the appropriate notifications: a user takes an action, and the system notifies other users.
Direct publishing to a channel from client code is appropriate in a limited number of cases. Check the PUSH_CATEGORY enum to see which channel categories support client-side publishing.