Documentation Index Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
// Send transient message to user
let data: [ String : Any ] = [ "LIVE_REACTION" : "heart" ]
let msg = TransientMessage ( receiverID : "UID" , receiverType : . user , data : data)
CometChat. sendTransientMessage ( message : msg)
// Listen for transient messages (CometChatMessageDelegate)
func onTransisentMessageReceived ( _ message : TransientMessage) {
print ( "Transient:" , message. data )
}
Key Characteristics
Characteristic Description Fire-and-forget No success/failure callbacks NOT persisted Cannot be retrieved from history Real-time only Receiver must be online No receipts No delivery/read receipts
Use Cases
Use Case Description Live reactions Heart, thumbs up, emoji animations Live location Real-time location sharing Ephemeral indicators Temporary status updates Custom real-time data Any data that doesn’t need persistence
Send Transient Message (User)
let data: [ String : Any ] = [ "LIVE_REACTION" : "heart" , "timestamp" : Date (). timeIntervalSince1970 ]
let transientMessage = TransientMessage ( receiverID : "cometchat-uid-2" , receiverType : . user , data : data)
CometChat. sendTransientMessage ( message : transientMessage)
// Note: Fire-and-forget - no success/failure callback
// Message is NOT persisted - receiver must be online
NSDictionary * data = @{ @"LIVE_REACTION" : @"heart" };
TransientMessage * transientMessage = [[TransientMessage alloc ] initWithReceiverID: @"cometchat-uid-2" receiverType: ReceiverTypeUser data: data];
[CometChat sendTransientMessageWithMessage: transientMessage];
Send Transient Message (Group)
let data: [ String : Any ] = [ "LIVE_REACTION" : "thumbsup" , "timestamp" : Date (). timeIntervalSince1970 ]
let transientMessage = TransientMessage ( receiverID : "cometchat-guid-1" , receiverType : . group , data : data)
CometChat. sendTransientMessage ( message : transientMessage)
Send Live Reaction
let data = [ "LIVE_REACTION" : "heart" , "type" : "live_reaction" ]
let transientMessage = TransientMessage ( receiverID : "cometchat-uid-2" , receiverType : . user , data : data)
CometChat. sendTransientMessage ( message : transientMessage)
Common Live Reactions
Reaction Value Heart "heart"Thumbs Up "thumbsup"Thumbs Down "thumbsdown"Laugh "laugh"Wow "wow"Sad "sad"Angry "angry"
Send Live Location
let data: [ String : Any ] = [
"type" : "live_location" ,
"latitude" : 37.7749 ,
"longitude" : -122.4194 ,
"accuracy" : 10.0 ,
"timestamp" : Date (). timeIntervalSince1970
]
let transientMessage = TransientMessage ( receiverID : "cometchat-uid-2" , receiverType : . user , data : data)
CometChat. sendTransientMessage ( message : transientMessage)
Live Location Data Properties
Property Type Description type String"live_location"latitude DoubleLatitude coordinate longitude DoubleLongitude coordinate accuracy DoubleLocation accuracy in meters timestamp DoubleUnix timestamp
Real-time Transient Message Events
To receive transient messages, implement CometChatMessageDelegate:
extension YourViewController : CometChatMessageDelegate {
func onTransisentMessageReceived ( _ message : TransientMessage) {
print ( "Transient message received" )
print ( "Sender UID: \( message. sender ? . uid ?? "" ) " )
print ( "Sender Name: \( message. sender ? . name ?? "" ) " )
print ( "Receiver ID: \( message. receiverID ) " )
print ( "Receiver Type: \( message. receiverType ) " )
print ( "Data: \( message. data ) " )
// Handle specific data types
if let reaction = message.data[ "LIVE_REACTION" ] as? String {
print ( "Live Reaction: \( reaction ) " )
// Show reaction animation
}
if let type = message.data[ "type" ] as? String , type == "live_location" {
let lat = message. data [ "latitude" ] as? Double ?? 0
let lon = message. data [ "longitude" ] as? Double ?? 0
print ( "Live Location: \( lat ) , \( lon ) " )
// Update map marker
}
}
}
// Register the delegate:
CometChat. messagedelegate = self
- ( void )onTransisentMessageReceived:(TransientMessage * )message {
NSLog ( @"TransientMessage received: %@ " , [message stringValue ]);
}
The received object is a TransientMessage .
TransientMessage Object Properties
Property Type Description senderUser?User who sent the transient message receiverIDStringUID of user or GUID of group receiverTypeReceiverType.user or .groupdata[String: Any]Custom data dictionary
Transient messages are NOT persisted and cannot be retrieved later. The receiver must be online to receive them. There are no delivery/read receipts for transient messages.
Next Steps
Typing Indicators Show real-time typing status in conversations
Send Messages Send text, media, and custom messages