---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/users/moderation
title: Report misbehaving users
updated_at: 2026-06-10T11:18:28.127Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Report misbehaving users

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to work with user metadata.
:::

Administrators are chat users with SDK instances initialized with a **Secret Key**. Admin moderation capabilities:

* Mute users on channels
* Ban users from accessing channels

Use [Access Manager](https://www.pubnub.com/docs/sdks/javascript/api-reference/access-manager) to enforce restrictions.

##### Usage in Blueprints and C++

You can use PubNub's functionality via Blueprints or directly in C++ code.

* In Blueprints, you can access PubNub from any Widget or Actor. Start by [initializing chat](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/configuration#initialize-pubnub-chat) using `InitChat` on `UPubnubChatSubsystem`. Afterwards, you can use the returned `UPubnubChat` object reference to call all Chat SDK functions.

:::warning Blueprint functions
The Blueprints provided in the documentation show how you can structure your application and may contain utility methods and elements like buttons that are not part of the Unreal Chat SDK and are meant to serve as guidance.
:::

* In C++, you can use UPubnubChatSubsystem as any other Game Instance Subsystem. #include "Kismet/GameplayStatics.h" #include "Engine/GameInstance.h" #include "PubnubChatSubsystem.h" // ACTION REQUIRED: Replace ASample_ChatSubsystem with name of your Actor class void ASample_ChatSubsystem::InitChatSample() { // Get PubnubChatSubsystem from GameInstance UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this); UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>(); // Initialize Chat - InitChat may fail under some conditions so make sure to check the Result for errors before using the Chat FPubnubChatInitChatResult InitChatResult = PubnubChatSubsystem->InitChat(TEXT("demo"), TEXT("demo"), TEXT("Player_001")); UPubnubChat* PubnubChat = InitChatResult.Chat; } Chat now allows you to call all Chat SDK functions, for example, Chat->GetChannel("my_channel").

:::note 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->SetRestrictionsAsync(UserID, Ban, Mute, OnOperationResponseDelegate, Reason); You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatOperationResponseNative).
* Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly. 1FPubnubChatOperationResult Result = Channel->SetRestrictions(UserID, Ban, Mute, Reason);
:::

## Mute or ban users

Mute or ban users with `SetRestrictions()` on the `Chat`, `User`, or `Channel` object. All three produce the same output with different input parameters.

**How it works:**

* Muting/banning creates a [moderation](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/custom-events#events-for-user-moderation) event (`muted` or `banned`)
* A moderation membership is created with `PUBNUB_INTERNAL_MODERATION_` prefix (secured via Access Manager, filtered from [GetMemberships()](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/membership#get-membership) results)
* Lifting restrictions removes the moderation membership and creates a `lifted` event

[Listen to moderation events](#listen-to-moderation-events) to trigger actions like removing [memberships](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/membership). [Check restrictions](#check-restrictions) to verify user status.

:::note Secret Key required
Initialize with **Secret Key** (from [Admin Portal](https://admin.pubnub.com/)) for admin operations. Never expose `Secret Key` to clients. If compromised, generate a new one in the Admin Portal.
:::

### Method signature

#### C++ / Input parameters

* User->SetRestrictions() 1User->SetRestrictions(2 const FString ChannelID,3 bool Ban,4 bool Mute,5 FString Reason = ""6);
* Channel->SetRestrictions() 1Channel->SetRestrictions(2 const FString UserID, 3 bool Ban, 4 bool Mute, 5 FString Reason = ""6);
* Chat->SetRestrictions() 1Chat->SetRestrictions(FPubnubChatRestriction Restriction);

| Parameter | Required for Chat | Required for User | Required for Channel | Description |
| --- | --- | --- | --- | --- |
| Restriction | FPubnubChatRestriction | Optional |  | Yes | No | No | Struct containing `UserID`, `ChannelID`, `Ban`, `Mute`, and `Reason` fields. Used by `Chat` only. |
| ChannelID | FString | Optional |  | No | Yes | No | ID of the channel on/from which the user should be muted or banned. Used by `User` and `Channel`. |
| UserID | FString | Optional |  | No | No | Yes | [Unique User ID](https://www.pubnub.com/docs/general/setup/users-and-devices) of the user to mute or ban. Used by `Channel` only. |
| Ban | bool | Optional |  | No | Yes | Yes | Set to `true` to ban the user from the channel or to `false` to unban them. |
| Mute | bool | Optional |  | No | Yes | Yes | Set to `true` to mute the user on the channel or to `false` to unmute them. |
| Reason | FString | Optional | `""` | No | No | No | Reason why you want to ban or mute the user. |

#### Blueprint

#### Output

| Method | Return type |
| --- | --- |
| `User->SetRestrictions()` | `FPubnubChatOperationResult` |
| `Chat->SetRestrictions()` | `FPubnubChatOperationResult` |
| `Channel->SetRestrictions()` | `FPubnubChatOperationResult` |

### Sample code

#### Mute

Mute `support_agent_15` on the `support` channel.

* SetRestrictions() (on the Chat object) C++UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|Chat|Moderation") void SetRestrictionsSample(); UFUNCTION() void OnSetRestrictionsResponse(const FPubnubChatOperationResult& Result);// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class void ASample_Chat::SetRestrictionsSample() { // snippet.hide UPubnubChat* Chat = nullptr; // snippet.show // Assumes Chat is a valid and initialized instance of UPubnubChat // Set or lift moderation restrictions (e.g. ban or mute a user on a channel) FPubnubChatRestriction Restriction; Restriction.UserID = TEXT("Player_002"); Restriction.ChannelID = TEXT("Lobby_001"); Restriction.Ban = true; Restriction.Reason = TEXT("Violation of rules"); FOnPubnubChatOperationResponseNative Callback; // ACTION REQUIRED: Replace ASample_Chat with name of your Actor class Callback.BindUObject(this, &ASample_Chat::OnSetRestrictionsResponse); Chat->SetRestrictionsAsync(Restriction, Callback); } // ACTION REQUIRED: Replace ASample_Chat with name of your Actor class void ASample_Chat::OnSetRestrictionsResponse(const FPubnubChatOperationResult& Result) { if (Result.Error) { return; } // Restrictions updated }
* SetRestrictions() (on the User object) C++// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class void ASample_ChatUser::SetRestrictionsSample() { // snippet.hide UPubnubChatUser* User = nullptr; // snippet.show // Assumes User is a valid UPubnubChatUser (e.g. from GetUser) // Channel ID on which to set or lift restrictions for this user FString ChannelID = TEXT("lobby-01"); // Set or lift ban/mute for this user on the channel User->SetRestrictionsAsync(ChannelID, false, true, nullptr, "inappropriate language"); }Blueprint
* SetRestrictions() (on the Channel object) C++// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class void ASample_ChatChannel::SetRestrictionsSample() { // snippet.hide UPubnubChatChannel* Channel = nullptr; // snippet.show // Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel) // User ID to set restrictions for FString UserID = TEXT("user-abc123"); // Set restriction (ban in this example) Channel->SetRestrictionsAsync(UserID, true, false, nullptr, TEXT("Cheater")); }Blueprint

#### Ban

Ban `support_agent_15` from the `support` channel.

* SetRestrictions() (on the Chat object) C++UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|Chat|Moderation") void SetRestrictionsSample(); UFUNCTION() void OnSetRestrictionsResponse(const FPubnubChatOperationResult& Result);// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class void ASample_Chat::SetRestrictionsSample() { // snippet.hide UPubnubChat* Chat = nullptr; // snippet.show // Assumes Chat is a valid and initialized instance of UPubnubChat // Set or lift moderation restrictions (e.g. ban or mute a user on a channel) FPubnubChatRestriction Restriction; Restriction.UserID = TEXT("Player_002"); Restriction.ChannelID = TEXT("Lobby_001"); Restriction.Ban = true; Restriction.Reason = TEXT("Violation of rules"); FOnPubnubChatOperationResponseNative Callback; // ACTION REQUIRED: Replace ASample_Chat with name of your Actor class Callback.BindUObject(this, &ASample_Chat::OnSetRestrictionsResponse); Chat->SetRestrictionsAsync(Restriction, Callback); } // ACTION REQUIRED: Replace ASample_Chat with name of your Actor class void ASample_Chat::OnSetRestrictionsResponse(const FPubnubChatOperationResult& Result) { if (Result.Error) { return; } // Restrictions updated }
* SetRestrictions() (on the User object — ban example) 1User->SetRestrictionsAsync("support", true, false, nullptr, "Banned for sending pictures of pineapple pizza.");
* SetRestrictions() (on the Channel object) C++// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class void ASample_ChatChannel::SetRestrictionsSample() { // snippet.hide UPubnubChatChannel* Channel = nullptr; // snippet.show // Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel) // User ID to set restrictions for FString UserID = TEXT("user-abc123"); // Set restriction (ban in this example) Channel->SetRestrictionsAsync(UserID, true, false, nullptr, TEXT("Cheater")); }Blueprint

#### Lift restrictions

## Check restrictions

### One user on one channel

Check `mute` or `ban` restrictions for a user on a specific channel with `GetChannelRestrictions()` or `GetUserRestrictions()`.

#### Method signature

##### C++ / Input parameters

* User->GetChannelRestrictions() 1User->GetChannelRestrictions(UPubnubChatChannel* Channel)
* Channel->GetUserRestrictions() 1Channel->GetUserRestrictions(UPubnubChatUser* User);

| Parameter | Required in `User->GetChannelRestrictions()` | Required in `Channel->GetUserRestrictions()` | Description |
| --- | --- | --- | --- |
| `Channel`Type: `UPubnubChatChannel*`Default: n/a | Yes | No | [Channel](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/channel) object on/from which the user can be muted or banned. |
| `User`Type: `UPubnubChatUser*`Default: n/a | No | Yes | [User](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/user) object that can be muted or banned. |

##### Blueprint

##### Output

| Parameter | Description |
| --- | --- |
| `User->GetChannelRestrictions()`Type: `FPubnubChatGetRestrictionResult` | Returned object containing `Result` and `Restriction`. |
| `Channel->GetUserRestrictions()`Type: `FPubnubChatGetRestrictionResult` | Returned object containing `Result` and `Restriction`. |
| `> Result`Type: `FPubnubChatOperationResult` | Operation status. |
| `> Restriction`Type: `FPubnubChatRestriction` | Restriction details. |
| `>> UserID`Type: `FString` | ID of the restricted user. |
| `>> ChannelID`Type: `FString` | ID of the channel. |
| `>> Ban`Type: `bool` | Info whether the user is banned from the channel. |
| `>> Mute`Type: `bool` | Info whether the user is muted on the channel. |
| `>> Reason`Type: `FString` | Reason why the user was banned or muted. |

#### Sample code

Check if the user `support_agent_15` has any restrictions set on the `support` channel.

* GetChannelRestrictions() C++// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class void ASample_ChatUser::GetChannelRestrictionsSample() { // snippet.hide UPubnubChatUser* User = nullptr; // snippet.show // Assumes User is a valid UPubnubChatUser (e.g. from GetUser) // Channel to query restrictions for UPubnubChatChannel* Channel = nullptr; // Callback for when the operation completes (returns ban/mute/reason) FOnPubnubChatGetRestrictionResponseNative Callback; // ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class Callback.BindUObject(this, &ASample_ChatUser::OnGetChannelRestrictionsResponse); User->GetChannelRestrictionsAsync(Channel, Callback); } // ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class void ASample_ChatUser::OnGetChannelRestrictionsResponse(const FPubnubChatGetRestrictionResult& Result) { if (Result.Result.Error) { return; } FPubnubChatRestriction Restriction = Result.Restriction; }Blueprint
* GetUserRestrictions() C++// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class void ASample_ChatChannel::GetUserRestrictionsSample() { // snippet.hide UPubnubChatChannel* Channel = nullptr; // snippet.show // Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel) // User to query restrictions for (e.g. from GetUser or members list) UPubnubChatUser* User = nullptr; // Callback for when the operation completes (returns ban/mute/reason for this user) FOnPubnubChatGetRestrictionResponseNative Callback; // ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class Callback.BindUObject(this, &ASample_ChatChannel::OnGetUserRestrictionsResponse); Channel->GetUserRestrictionsAsync(User, Callback); } // ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class void ASample_ChatChannel::OnGetUserRestrictionsResponse(const FPubnubChatGetRestrictionResult& Result) { if (Result.Result.Error) { return; } FPubnubChatRestriction Restriction = Result.Restriction; }Blueprint

### One user on all channels

Check `mute` or `ban` restrictions for a user across all their channels with `GetChannelsRestrictions()`.

#### Method signature

```cpp
User->GetChannelsRestrictions(
    int Limit = 0,
    FPubnubMembershipSort Sort = FPubnubMembershipSort(),
    FPubnubPage Page = FPubnubPage()
);
```

| Parameter | Description |
| --- | --- |
| `Limit`Type: `int`Default: `100` | Number of objects to return in response. The default (and maximum) value is `100`. |
| `Page`Type: `FPubnubPage`Default: n/a | Object used for pagination to define which previous or next result page you want to fetch. |
| `> Next`Type: `FString`Default: n/a | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `> Prev`Type: `FString`Default: n/a | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `next` parameter is supplied. |
| `Sort`Type: `FPubnubMembershipSort`Default: n/a | Struct used to specify a property to sort by and sort direction. Available options are `id`, `name`, and `updated`. Use `asc` or `desc` to specify the sorting direction. By default, the items are sorted by the last updated date. |

##### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatGetRestrictionsResult`Type: `struct` | Returned object containing these fields: `Result`, `Restrictions`, `Page`, and `Total`. |
| `> Result`Type: `FPubnubChatOperationResult` | Operation status. |
| `> Restrictions`Type: `TArray<FPubnubChatRestriction>` | Array containing restrictions. |
| `>> UserID`Type: `FString` | ID of the restricted user. |
| `>> ChannelID`Type: `FString` | ID of the channel containing user restrictions. |
| `>> Ban`Type: `bool` | Info whether the user is banned from the given channel. |
| `>> Mute`Type: `bool` | Info whether the user is muted on the given channel. |
| `>> Reason`Type: `FString` | Reason why the user was banned or muted. |
| `> Page`Type: `FPubnubPage` | Object used for pagination to define which previous or next result page you want to fetch. |
| `>> Next`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `>> Prev`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `Next` parameter is supplied. |
| `> Total`Type: `int` | Total number of restrictions. |

#### Sample code

List all `mute` and `ban` restrictions set for a user.

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::GetChannelsRestrictionsSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetUser)

	// Callback for when the operation completes (returns restrictions across channels)
	FOnPubnubChatGetRestrictionsResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatUser::OnGetChannelsRestrictionsResponse);
	User->GetChannelsRestrictionsAsync(Callback);
}

// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::OnGetChannelsRestrictionsResponse(const FPubnubChatGetRestrictionsResult& Result)
{
	if (Result.Result.Error) { return; }
	TArray<FPubnubChatRestriction> Restrictions = Result.Restrictions;
}
```

### All users on one channel

Check `mute` or `ban` restrictions for all members of a channel with `GetUsersRestrictions()`.

#### Method signature

```cpp
Channel->GetUsersRestrictions(
    int Limit = 0,
    FPubnubMembershipSort Sort = FPubnubMembershipSort(),
    FPubnubPage Page = FPubnubPage()
);
```

| Parameter | Description |
| --- | --- |
| `Limit`Type: `int`Default: `0` (server default) | Number of objects to return in response. |
| `Page`Type: `FPubnubPage`Default: n/a | Object used for pagination to define which previous or next result page you want to fetch. |
| `> Next`Type: `FString`Default: n/a | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `> Prev`Type: `FString`Default: n/a | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `next` parameter is supplied. |
| `Sort`Type: `FPubnubMembershipSort`Default: n/a | Struct used to specify a property to sort by and sort direction. Available options are `id`, `name`, and `updated`. Use `asc` or `desc` to specify the sorting direction. By default, the items are sorted by the last updated date. |

##### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatGetRestrictionsResult`Type: `struct` | Returned object containing these fields: `Result`, `Restrictions`, `Page`, and `Total`. |
| `> Result`Type: `FPubnubChatOperationResult` | Operation status. |
| `> Restrictions`Type: `TArray<FPubnubChatRestriction>` | Array containing restrictions. |
| `>> UserID`Type: `FString` | ID of the restricted user. |
| `>> ChannelID`Type: `FString` | ID of the channel. |
| `>> Ban`Type: `bool` | Info whether the user is banned from the given channel. |
| `>> Mute`Type: `bool` | Info whether the user is muted on the given channel. |
| `>> Reason`Type: `FString` | Reason why the user was banned or muted. |
| `> Page`Type: `FPubnubPage` | Object used for pagination to define which previous or next result page you want to fetch. |
| `>> Next`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `>> Prev`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `Next` parameter is supplied. |
| `> Total`Type: `int` | Total number of restrictions. |

#### Sample code

List all `mute` and `ban` restrictions set for the `support` channel.

```cpp
// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::GetUsersRestrictionsSample()
{
	// snippet.hide
	UPubnubChatChannel* Channel = nullptr;
	// snippet.show

	// Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel)

	// Callback for when the operation completes (returns list of restrictions)
	FOnPubnubChatGetRestrictionsResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatChannel::OnGetUsersRestrictionsResponse);
	Channel->GetUsersRestrictionsAsync(Callback);
}

// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::OnGetUsersRestrictionsResponse(const FPubnubChatGetRestrictionsResult& Result)
{
	if (Result.Result.Error) { return; }
	TArray<FPubnubChatRestriction> Restrictions = Result.Restrictions;
}
```

## Secure moderation

Client-side UI restrictions (hiding channels, disabling input) can be bypassed. Secure with [server-side logic](#server-side-restrictions) using Access Manager, plus optional [client-side feedback](#client-side-restrictions).

### Server-side restrictions

Use [Access Manager](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/users/permissions) with Chat SDK methods to grant/revoke permissions based on muting/banning restrictions.

**Recommended workflow:**

1. Admin [sets restrictions](#mute-or-ban-users) via dashboard (e.g., [Channel Monitor](https://www.pubnub.com/docs/bizops-workspace/channel-monitor#users))
2. [Get moderation restrictions](#check-restrictions) for users
3. Call Access Manager API to generate/revoke tokens

**Implementation steps:**

1. Enable Access Manager in the Admin Portal.
2. Initialize Chat SDK with Auth Key on the frontend to authenticate users and grant access to PubNub resources.
3. Initialize backend with Secret Key using the Unreal SDK to secure your PubNub instance. tipSecret Key signs and verifies messages for Access Manager. Never expose to clients.
4. Get user permissions - Retrieve restrictions with Get user details and Check restrictions, then convert to permission format (read/write/access per channel).
5. Generate authorization token - Assign an access token with channel permissions and validity period. tipSee Permissions for the complete operation-to-permission mapping. Short TTLs recommendedUse short-lived tokens (TTLs) for up-to-date restrictions.
6. Listen for moderation events - Listen for the moderation event type (banned, muted, or lifted).
7. Act on moderation events - Update permissions and generate new tokens as needed.

### Client-side restrictions

With [server-side permissions](#server-side-restrictions) enforced, add optional client-side UI feedback. [Read moderation restrictions](#check-restrictions) to display popup messages or icons informing users about their mute/ban status before they attempt restricted actions.

## Listen to moderation events

Subscribe to real-time moderation changes for a user with `StreamRestrictions()`. Bind the user's `OnRestrictionChanged` delegate before calling this method.

| Delegate | Type | Payload |
| --- | --- | --- |
| `OnRestrictionChanged` | `FOnPubnubChatUserRestrictionChanged` | `FPubnubChatRestriction` containing `Ban` (bool), `Mute` (bool), `Reason` (FString), and `ChannelID` (FString). |

### Method signature

```cpp
User->StreamRestrictions();
```

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage`. Check `Error` to determine if the subscription started successfully. |

### Sample code

###### Actor.h

```cpp
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatUser")
void StreamRestrictionsSample();

void OnRestrictionChanged(const FPubnubChatRestriction& Restriction);
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::StreamRestrictionsSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetCurrentUser)

	// Bind to receive moderation restriction changes for this user
	User->OnRestrictionChangedNative.AddUObject(this, &ASample_ChatUser::OnRestrictionChanged);

	// Start streaming restriction events
	User->StreamRestrictionsAsync(nullptr);

	// When restriction events are no longer needed, stop streaming
	User->StopStreamingRestrictionsAsync(nullptr);
}

// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::OnRestrictionChanged(const FPubnubChatRestriction& Restriction)
{
	/* e.g. update UI to reflect ban/mute changes */
}
```

### Stopping updates

To stop receiving moderation events, call `StopStreamingRestrictions()` on the user.

```cpp
User->StopStreamingRestrictions();
```

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage`. |

## Terms in this document

* **Access Manager** - A cryptographic, token-based permission administrator that allows you to regulate clients' access to PubNub resources, such as channels, channel groups, and user IDs.
* **Action** - The type of activity (procedure) to execute when a condition is satisfied (for example, sending a message).
* **Billing alert notification** - A means of informing a user that a billing alert has been triggered. Before notifications can happen, a billing alert must be triggered first.
* **Business Object** - A container for data fields and metrics that defines aggregations and data sources.
* **Channel** - A pathway for sending and receiving messages between devices, created automatically when you first use it, that can handle any number of users and messages for different communication needs, like 1-1 text chats, group conversations, and other data streaming.
* **Channel pattern** - A way to group and analyze channel data to track performance metrics like message counts and user engagement over time with PubNub Insights.
* **Condition** - A requirement that must be satisfied or evaluated to true for an action to be executed. Input in a decision table.
* **Cryptor** - An implementation of a specific cryptographic algorithm used for data encryption/decryption that adheres to a standard interface.
* **Dashboard** - A collection of widgets (charts) that give an overview of the metrics one is evaluating.
* **Data fields** - Data you want Illuminate to track. These can be quantitative (measures), like "Number" or "Timestamp" or qualitative (dimensions) values, like "String" that can be used to categorize and segment data. Data fields can be aggregated and calculated.
* **Decision** - A collection (or decision table) of conditions and actions. When conditions are satisfied, the corresponding actions are triggered as per defined rules.
* **End Customer** - A customer of a PubNub partner. End customers do not have direct access to the Admin Portal. Instead, they interact with PubNub products—such as Illuminate—through the partner’s portal, where PubNub services are embedded. They can create PubNub objects only within this partner-provided environment.
* **Entity** - A subscribable object within a PubNub SDK that allows you to perform context-specific operations.
* **Listener** - A function or objectthat reacts to events or messages, like new chat messages or connection updates, letting your app respond in real-time.
* **Mapped/Unmapped** - Whether the data source for a data field has been defined or the action has been configured.
* **MCP Server** - A Model Context Protocol server that coordinates communication and synchronization between AI agents, clients, or services, such as Cursor IDE and Windsurf.
* **Message** - A unit of data transmitted between clients or between a client and a server in PubNub, containing information such as text, binary data, or structured data formats like JSON. Messages are sent over channels and can be tracked for delivery and read status.
* **Metric** - What exactly is evaluated using measures and dimensions (collectively called data fields), as well as aggregation functions.
* **Module** - A Functions v1 container that groups related functions for configuration and deployment on an app’s keysets.
* **Origin** - The subdomain used to establish a connection to the PubNub network that allows your application's traffic to appear like it's coming from your own domain.
* **Package** - A Functions v2 container that groups Functions, tracks Revisions, and is deployed to keysets.
* **Partner** - A PubNub customer who resells PubNub products, such as Illuminate, to their own customers. Partners have access to the Admin Portal, enabling them to create and manage PubNub objects for themselves or on behalf of their end customers.
* **Publish Key** - A unique identifier that allows your application to send messages to PubNub channels. It's part of your app's credentials and should be kept secure.
* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
* **Push token** - A device identifier issued by a push provider (APNs or FCM) used to register a device for receiving mobile push notifications.
* **Rule** - A definition (row in a decision table) stating which action should be triggered for which condition.
* **Service Integration** - A machine identity that represents a program or service consuming the Admin API, scoped to your account and authenticated using expirable API keys with configurable permissions.
* **Signal** - A non-persistent message limited to 64 bytes designed for high-volume usecases where the the most recent data is relevant, like GPS location updates.
* **Subscribe Key** - A unique identifier that allows your application to receive messages from PubNub channels. It's part of your app's credentials and should be kept secure.
* **Timetoken** - A unique identifier for each message that represents the number of 100-nanosecond intervals since January 1, 1970, for example, 16200000000000000.
* **Trigger details** - A set of predefined criteria for a given billing alert. When met, billing alert notifications are generated.
* **User** - An individual or entity that interacts with a system, application, or service. In PubNub, a user typically refers to someone who sends or receives messages through the platform, identified by a unique user ID or username.
* **User ID** - UTF-8 encoded, unique string of up to 92 characters used to identify a single client (end user, device, or server) that connects to PubNub.
* **Vibe Coding** - A way to build applications in an intuitive, relaxed, and improvisational manner, using AI tools and natural language descriptions.
