Chat object
Once you initialize the Unreal Chat SDK and create its instance, you'll get immediate access to the Chat
entity from which you can call the PubNub server.
To communicate with PubNub, you can use various methods. For example, you can use DeleteChannel()
to remove a given channel (Chat->DeleteChannel("support")
) or WherePresent()
to check which channels a given user is subscribed to (Chat->WherePresent("support_agent_15")
).
By calling methods on the Chat
entity, you create chat objects like Channel
, User
, Message
, Membership
, ThreadChannel
, and ThreadMessage
. These objects also expose Chat API under various methods, letting you perform CRUD operations on messages, channels, users, the related user-channel membership, and many more.
Each of these entities comes with a set of readonly
parameters you define when creating, modifying, and deleting specific channels, users, messages, or memberships in your chat app.
Properties
The Chat
object is returned and initialized by the following operation:
PubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem->InitChat("demo", "demo", "my_user");
To initialize the Unreal Chat SDK, you must provide three parameters: Publish Key
, Subscribe Key
, and User ID
, while all other settings are optional. Read the Configuration page for details.
Methods
You can call the following methods on the Chat
object.
Click on each method for more details.
CreateUser()
CreateDirectConversation()
CreateGroupConversation()
CreatePublicConversation()
DeleteChannel()
DeleteUser()
EmitEvent()
GetEventsHistory()
GetChannel()
GetChannels()
GetChannelSuggestions()
GetCurrentUserMentions()
GetUser()
GetUsers()
GetUserSuggestions()
Init()
IsPresent()
ListenForEvents()
SetRestrictions()
UpdateChannel()
UpdateUser()
WherePresent()
WhoIsPresent()
Use case
For example, you can use the Chat
object methods to: