Join channels
Requires App Context
Enable App Context on your keyset in the Admin Portal to manage memberships.
Use Join() to create a channel membership for the user. The user is recorded as a channel member.
Receiving messages after joining
Join() creates the membership but does not subscribe to the channel. To start receiving messages, bind the channel's OnMessageReceived delegate and call Connect() separately after Join() returns.
Asynchronous and synchronous method execution
Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.
-
Asynchronous methods (
Asyncsuffix) returnvoidand take an optional delegate parameter that fires when the operation completes.1Channel->JoinAsync(MembershipData, OnJoinResponseDelegate);You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the
Nativesuffix (for example,FOnPubnubChatJoinResponseNative). -
Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly.
1FPubnubChatJoinResult Result = Channel->Join(MembershipData);
Method signature
- C++ / Input parameters
- Blueprint
1Channel->Join(
2 FPubnubChatMembershipData MembershipData = FPubnubChatMembershipData()
3);
| Parameter | Description |
|---|---|
MembershipDataType: FPubnubChatMembershipDataDefault: FPubnubChatMembershipData() | The object containing all membership data. For more information, refer to FPubnubChatMembershipData. |
Output
| Type | Description |
|---|---|
FPubnubChatJoinResult | Contains Result (FPubnubChatOperationResult with Error/ErrorMessage) and Membership (UPubnubChatMembership*). |
Sample code
Join the support channel and mark this membership as premium to add information about your support plan.
- C++
- Blueprint
1