On this page

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.

icon

Usage in Blueprints and C++


Asynchronous and synchronous method execution

Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.

  • Asynchronous methods (Async suffix) return void and 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 Native suffix (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

1Channel->Join(
2 FPubnubChatMembershipData MembershipData = FPubnubChatMembershipData()
3);
* required
ParameterDescription
MembershipData
Type: FPubnubChatMembershipData
Default:
FPubnubChatMembershipData()
The object containing all membership data. For more information, refer to FPubnubChatMembershipData.

Output

TypeDescription
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.

1

Last updated on