Skip to main content
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.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.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:
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.