AI Integration Quick Reference
AI Integration Quick Reference
Overview
The v7 event system merges CometChat SDK listener events (from the network) with local UI events (from component actions) into a single pub/sub bus. Components subscribe to events they care about and publish events when they perform actions that other components need to know about. This replaces v6’s RxJS-basedCometChatMessageEvents, CometChatGroupEvents, etc. with a single unified system.
How It Works
- SDK listeners are attached when
CometChatEventsProvidermounts (after login) - When the SDK fires a listener callback, it’s converted to a typed event and emitted to all subscribers
- Components can also publish UI events for local cross-component communication
- All subscribers receive all events — filter by
event.typein your handler
Subscribing to Events
Use theuseCometChatEvents hook to subscribe:
Publishing UI Events
Use theusePublishEvent hook to publish events that other components can react to:
ui: prefixed events can be published by components. SDK events are emitted internally by the provider.