Skip to main content

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.

There are two ways to get messages in the CometChat Unreal SDK:
  1. Fetch history — pull previous messages for a conversation using async nodes
  2. Real-time push — listen for new messages as they arrive via the OnMessageReceived delegate

How Messages Flow


Fetch User Messages

Retrieve the message history for a 1:1 conversation.
Call the Get Messages Async node.
ParameterTypeDescription
UidFStringThe UID of the other user in the conversation
Limitint32Maximum number of messages to return (default: 50)
On Success returns a TArray<FCometChatMessage> — an array of messages sorted by timestamp.

Fetch Group Messages

Retrieve the message history for a group conversation, with pagination support.
Call the Get Group Messages Async node.
ParameterTypeDescription
GuidFStringThe group’s unique identifier
Limitint32Maximum messages per page (default: 50)
Before Message Idint32Pass 0 for the first page. For subsequent pages, pass the NextCursor value from the previous response’s FCometChatPagination.
On Success returns two outputs:
  • TArray<FCometChatMessage> — the messages for this page
  • FCometChatPagination — pagination metadata including HasMore and NextCursor

Pagination

The FCometChatPagination struct tells you where you are in the message history:
PropertyTypeDescription
Totalint32Total messages available in the conversation
Countint32Messages returned in this page
PerPageint32Page size that was requested
HasMorebooltrue if there are older messages to fetch
NextCursorint32Pass this as BeforeMessageId to get the next page
Infinite scroll pattern: Start with BeforeMessageId = 0, then keep passing NextCursor from each response until HasMore is false.

Real-Time: Incoming Messages

To receive messages as they arrive (without polling), bind to the OnMessageReceived delegate on the Subsystem.
  1. Get a reference to the CometChat Subsystem
  2. Drag off and search for On Message Received
  3. Use Bind Event to connect it to a custom event
  4. The custom event receives an FCometChatMessage parameter
Bind this before calling Login so you don’t miss any messages.
The OnMessageReceived delegate fires for all conversations — both 1:1 and group. Use ReceiverType to distinguish between them, and ConversationId to route messages to the right chat window.

Next Steps

Users

Fetch user profiles and track presence.

Groups

Create, join, and leave groups.

Real-Time Events

All five real-time delegates explained in detail.