---
source_url: https://www.pubnub.com/docs/sdks/java/api-reference/storage-and-playback
title: Message Persistence API for Java SDK
updated_at: 2026-06-19T11:37:29.221Z
sdk_name: PubNub Java SDK
sdk_version: 6.4.5
---

> 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


# Message Persistence API for Java SDK

PubNub Java SDK, use the latest version: 6.4.5

Install:

```bash
Add PubNub dependency to your build@6.4.5
```

:::warning Breaking changes in v9.0.0
PubNub Java SDK version 9.0.0 unifies the codebases for Java and [Kotlin](https://www.pubnub.com/docs/sdks/kotlin) SDKs, introduces a new way of instantiating the PubNub client, and changes asynchronous API callbacks and emitted [status events](https://www.pubnub.com/docs/sdks/java/status-events). These changes can impact applications built with previous versions (< `9.0.0`) of the Java SDK.
For more details about what has changed, refer to [Java/Kotlin SDK migration guide](https://www.pubnub.com/docs/sdks/kotlin/migration-guides/kotlin-v9-migration-guide).
:::

Message Persistence gives you real-time access to the history of messages published to PubNub. Each message is timestamped to the nearest 10 nanoseconds and stored across multiple availability zones in several geographic locations. You can encrypt stored messages with AES-256 so they are not readable on PubNub’s network. For details, see [Message Persistence](https://www.pubnub.com/docs/general/storage).

You control how long messages are stored through your account’s retention policy. Options include: 1 day, 7 days, 30 days, 3 months, 6 months, 1 year, or Unlimited.

You can retrieve the following:

* Messages
* Message reactions
* Files (using the File Sharing API)

## Fetch history

:::warning Requires Message Persistence
Enable Message Persistence for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Fetch historical messages from one or more channels. Use `includeMessageActions` to include message actions.

You control how messages are returned and in what order:

* If you specify only the `start` parameter (without `end`), you receive messages older than the `start` [timetoken](https://www.pubnub.com/docs/sdks/java/api-reference/misc#time).
* If you specify only the `end` parameter (without `start`), you receive messages from that `end` timetoken and newer.
* If you specify both `start` and `end`, you retrieve messages between those timetokens (inclusive of the `end` value).

You can receive up to 100 messages for a single channel. For multiple channels (up to 500), you can receive up to 25 messages per channel. If more messages match the time range, make iterative calls and adjust the `start` timetoken to page through the results.

### Method(s)

Use the following method(s) in the Java SDK:

```java
this.pubnub.fetchMessages()
    .channels(List<String>)
    .maximumPerChannel(Integer)
    .start(Long)
    .end(Long)
    .includeMessageActions(Boolean)
    .includeMeta(Boolean)
    .includeMessageType(Boolean)
    .includeCustomMessageType(Boolean)
    .includeUUID(Boolean)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| channels | List<String> | Yes |  | Channels to fetch history messages from (up to 500). |
| maximumPerChannel | Integer | Optional | `100 or 25` | Number of historical messages to return. Default and maximum are 100 (single), 25 (multi), and 25 with `includeMessageActions`. |
| start | Long | Optional |  | Timetoken delimiting the start (exclusive) of the time slice. |
| end | Long | Optional |  | Timetoken delimiting the end (inclusive) of the time slice. |
| includeMessageActions | Boolean | Optional | `false` | Whether to retrieve history messages with message actions. If `true`, limited to one channel and 25 messages. Default is `false`. |
| includeMeta | Boolean | Optional | `false` | Whether to include the meta object (if provided at publish time) in the response. |
| includeMessageType | Boolean | Optional | `true` | Whether to pass `true` to include message type. Default is `true`. |
| includeCustomMessageType | Boolean | Optional | `false` | Whether to retrieve messages with the custom message type. See [Retrieving Messages](https://www.pubnub.com/docs/general/storage#retrieve-messages). |
| includeUUID | Boolean | Optional | `true` | Whether to receive the publisher uuid. Default is `true`. |
| async | Consumer<Result> | Yes |  | `Consumer` of a `Result` of type `PNFetchMessagesResult`. |

:::note Truncated response
If you fetch messages with message actions, the response may be truncated when internal limits are reached. If truncated, a `more` property is returned with additional parameters. Make iterative calls to history, adjusting the parameters to fetch more messages.
:::

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. It includes necessary imports and executes methods with console logging. Use it as a reference when working with other examples in this document.
:::

Retrieve the last message on a channel:

```java
import com.pubnub.api.PubNubException;
import com.pubnub.api.java.PubNub;
import com.pubnub.api.java.v2.PNConfiguration;
import com.pubnub.api.UserId;
import com.pubnub.api.models.consumer.history.PNFetchMessageItem;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class FetchMessagesApp {
    public static void main(String[] args) throws PubNubException {
        // Configure PubNub instance
        PNConfiguration.Builder configBuilder = PNConfiguration.builder(new UserId("demoUserId"), "demo");
        configBuilder.publishKey("demo");
        configBuilder.secure(true);

        PubNub pubnub = PubNub.create(configBuilder.build());

        // Fetch historical messages
        pubnub.fetchMessages()
                .channels(Arrays.asList("my_channel"))
                .maximumPerChannel(25)
                .includeMessageActions(true)
                .includeMeta(true)
                .includeMessageType(true)
                .includeCustomMessageType(true)
                .includeUUID(true)
                .async(result -> {
                    result.onSuccess(res -> {
                        Map<String, List<PNFetchMessageItem>> channels = res.getChannels();
                        for (PNFetchMessageItem messageItem : channels.get("my_channel")) {
                            System.out.println("Message: " + messageItem.getMessage());
                            System.out.println("Meta: " + messageItem.getMeta());
                            System.out.println("Timetoken: " + messageItem.getTimetoken());
                            System.out.println("Message Type: " + messageItem.getMessageType());
                            System.out.println("UUID: " + messageItem.getUuid());
                            Map<String, Map<String, List<PNFetchMessageItem.Action>>> actions = messageItem.getActions();
                            for (String type : actions.keySet()) {
                                System.out.println("Action type: " + type);
                                for (String value : actions.get(type).keySet()) {
                                    System.out.println("Action value: " + value);
                                    for (PNFetchMessageItem.Action action : actions.get(type).get(value)) {
                                        System.out.println("Action timetoken: " + action.getActionTimetoken());
                                        System.out.println("Action publisher: " + action.getUuid());
                                    }
                                }
                            }
                        }
                    }).onFailure(exception -> {
                        System.out.println("Error fetching messages: " + exception.getMessage());
                    });
                });
    }
}
```

### Returns

The `fetchMessages()` operation returns a list of `PNFetchMessagesResult` objects, each containing the following operations:

| Method | Description |
| --- | --- |
| `getMessage()`Type: JsonElement | Message content. |
| `getMeta()`Type: JsonElement | Message metadata if any, and if requested via `includeMeta(true)`. |
| `getTimetoken()`Type: Long | Publish timetoken. |
| `getActionTimetoken()`Type: Long | Timestamp when the message action was created. |
| `getActions()`Type: HashMap | Actions data of the message, if any, and if requested via `includeMessageActions(true)`. |
| `getMessageType()`Type: Integer | **Message type** `0` - message, `1` - signal, `2` - object, `3` - message action, `4` - files |
| `getCustomMessageType()`Type: String | The custom message type. |
| `getUuid()`Type: String | UUID of the publisher |

### Other examples

#### Paging history responses

```java
import com.pubnub.api.PubNubException;
import com.pubnub.api.UserId;
import com.pubnub.api.java.PubNub;
import com.pubnub.api.java.v2.PNConfiguration;
import com.pubnub.api.models.consumer.history.PNFetchMessageItem;
import com.pubnub.api.models.consumer.history.PNFetchMessagesResult;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

public class FetchMessagesWithPagingApp {

    public static void main(String[] args) {
        long timetokenOfLastMessage = 17_474_884_096_044_353L;
        List<String> channels = Arrays.asList("kotlin-ch1", "kotlin-ch2");

        getAllMessages(channels, timetokenOfLastMessage + 1, res -> {
            res.getChannels().forEach((channel, msgs) -> {
                System.out.println("Channel " + channel);
                msgs.forEach(System.out::println);
            });
        });
    }

    private static void getAllMessages(
            List<String> channels,
            long startTimestamp,
            Consumer<PNFetchMessagesResult> callback
    ) {
        UserId userId = null;
        try {
            userId = new UserId("history-demo-user");
        } catch (PubNubException e) {
            throw new RuntimeException(e);
        }
        PNConfiguration config = PNConfiguration.builder(userId, "demo")
                .publishKey("demo")
                .build();

        PubNub pubnub = PubNub.create(config);

        pubnub.fetchMessages()
                .channels(channels)
                .start(startTimestamp)
                .maximumPerChannel(25)
                .async(result -> result
                        .onSuccess((PNFetchMessagesResult res) -> {
                            // res is your PNFetchMessagesResult
                            if (!res.getChannels().isEmpty()) {
                                // hand off to user callback
                                callback.accept(res);

                                // find next (smaller) timetoken and recurse
                                long nextStart = startTimestamp;
                                for (List<PNFetchMessageItem> msgs : res.getChannels().values()) {
                                    for (PNFetchMessageItem msg : msgs) {
                                        Long tt = msg.getTimetoken();
                                        if (tt != null && tt < nextStart) {
                                            nextStart = tt;
                                        }
                                    }
                                }
                                getAllMessages(channels, nextStart, callback);
                            }
                        })
                        .onFailure((PubNubException exception) -> {
                            // handle error
                            System.err.println("Fetch error: " + exception.getMessage());
                        })
                );
    }
}
//snippet.end
```

## Delete messages from history

:::warning Requires Message Persistence
Enable Message Persistence for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Remove messages from the history of a specific channel.

:::note Required setting
Enable `Delete-From-History` for your key in the Admin Portal and initialize the SDK with a secret key.
:::

### Method(s)

Use the following method(s) in the Java SDK:

```java
this.pubnub.deleteMessages()
    .channels(Array)
    .start(Long)
    .end(Long)
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: ArrayDefault: n/a | Channels to delete messages from. |
| `start`Type: LongDefault: n/a | Timetoken delimiting the start (inclusive) of the time slice. |
| `end`Type: LongDefault: n/a | Timetoken delimiting the end (exclusive) of the time slice. |
| `async` *Type: `Consumer<Result>`Default: n/a | `Consumer` of a `Result` of type `PNDeleteMessagesResult`. |

### Sample code

```java
pubNub.deleteMessages()
        .channels(Arrays.asList("channel_1", "channel_2"))
        .start(1460693607379L)
        .end(1460893617271L)
        .async(result -> { /* check result */ });
```

### Other examples

#### Delete specific message from history

To delete a specific message, pass the `publish timetoken` (received from a successful publish) in the `End` parameter and `timetoken +/- 1` in the `Start` parameter. For example, if `15526611838554310` is the `publish timetoken`, pass `15526611838554309` in `Start` and `15526611838554310` in `End` parameters respectively as shown in the following code snippet.

```java
pubNub.deleteMessages()
        .channels(Arrays.asList("channel_1"))
        .start(15526611838554309L)
        .end(15526611838554310L)
        .async(result -> { /* check result */ });
```

## Message counts

:::warning Requires Message Persistence
Enable Message Persistence for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Return the number of messages published since the given time. The count is the number of messages with a timetoken greater than or equal to `channelsTimetoken`.

:::note Unlimited message retention
Only messages from the last 30 days are counted.
:::

### Method(s)

Use the following method(s) in the Java SDK:

```java
this.pubnub.messageCounts()
    .channels(Array)
    .channelsTimetoken(Array)
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: ArrayDefault: n/a | Channels to fetch the message count. |
| `channelsTimetoken` *Type: ArrayDefault: n/a | Array in the same order as channels; a single timetoken applies to all channels; otherwise, lengths must match exactly. |
| `async` *Type: `Consumer<Result>`Default: n/a | `Consumer` of a `Result` of type `PNMessageCountResult`. |

### Sample code

```java
Long lastHourTimetoken = (Calendar.getInstance().getTimeInMillis() - TimeUnit.HOURS.toMillis(1)) * 10000L;

pubNub.messageCounts()
        .channels(Arrays.asList("news"))
        .channelsTimetoken(Arrays.asList(lastHourTimetoken))
        .async(result -> {
            result.onSuccess((PNMessageCountResult res) -> {
                for (Map.Entry<String, Long> messageCountEntry : res.getChannels().entrySet()) {
                    messageCountEntry.getKey(); // the channel name
                    messageCountEntry.getValue(); // number of messages for that channel
                }
            }).onFailure(( PubNubException exception) -> {
                exception.getMessage();
            });
        });
```

### Returns

The operation returns a `PNMessageCountResult` which contains the following operations

| Method | Description |
| --- | --- |
| `getChannels()`Type: Map`<String, Long>` | A map with values of `Long` for each channel. `Channels` without messages have a count of 0. `Channels` with 10,000 messages or more have a count of 10000. |

### Other examples

#### Retrieve count of messages using different timetokens for each channel

```java
Long lastHourTimetokenForNewsChannel = (Calendar.getInstance().getTimeInMillis() - TimeUnit.HOURS.toMillis(1)) * 10000L;
Long lastDayTimetokenForInfoChannel = (Calendar.getInstance().getTimeInMillis() - TimeUnit.DAYS.toMillis(1)) * 10000L;

pubNub.messageCounts()
        .channels(Arrays.asList("news", "info"))
        .channelsTimetoken(Arrays.asList(lastHourTimetokenForNewsChannel, lastDayTimetokenForInfoChannel))
        .async(result -> {
            result.onSuccess((PNMessageCountResult res) -> {
                for (Map.Entry<String, Long> messageCountEntry : res.getChannels().entrySet()) {
                    messageCountEntry.getKey(); // the channel name
                    messageCountEntry.getValue(); // number of messages for that channel
                }
            }).onFailure(( PubNubException exception) -> {
                exception.getMessage();
            });
        });
```

## History (deprecated)

:::warning Requires Message Persistence
Enable Message Persistence for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

:::note Alternative method
This method is deprecated. Use [fetch history](#fetch-history) instead.
:::

This function fetches historical messages of a channel.

It is possible to control how messages are returned and in what order, for example you can:

* Search for messages starting on the newest end of the timeline (default behavior - `reverse` = `false`)
* Search for messages from the oldest end of the timeline by setting `reverse` to `true`.
* Page through results by providing a `start` OR `end` timetoken.
* Retrieve a *slice* of the time line by providing both a `start` AND `end` timetoken.
* Limit the number of messages to a specific quantity using the `count` parameter.

:::tip Start & End parameter usage clarity
If only the `start` parameter is specified (without `end`), you will receive messages that are **older** than and up to that `start` timetoken value. If only the `end` parameter is specified (without `start`) you will receive messages that match that `end` timetoken value and **newer**. Specifying values for both `start` *and* `end` parameters will return messages between those timetoken values (inclusive on the `end` value). Keep in mind that you will still receive a maximum of 100 messages even if there are more messages that meet the timetoken values. Iterative calls to history adjusting the `start` timetoken is necessary to page through the full set of results if more than 100 messages meet the timetoken values.
:::

### Method(s)

Use the following method(s) in the Java SDK:

```java
this.pubnub.history()
    .channel(String)
    .reverse(Boolean)
    .includeTimetoken(Boolean)
    .includeMeta(Boolean)
    .start(Long)
    .end(Long)
    .count(Integer);
```

| Parameter | Description |
| --- | --- |
| `channel` *Type: StringDefault: n/a | Channel to return history messages from. |
| `reverse`Type: BooleanDefault: `false` | Traverse from oldest to newest when set to `true`. |
| `includeTimetoken`Type: BooleanDefault: `false` | Whether to include message timetokens in the response. |
| `includeMeta`Type: BooleanDefault: `false` | Whether to include the meta object (if provided at publish time) in the response. |
| `start`Type: LongDefault: n/a | Timetoken delimiting the start (exclusive) of the time slice. |
| `end`Type: LongDefault: n/a | Timetoken delimiting the end (inclusive) of the time slice. |
| `count`Type: IntDefault: `100` | Number of historical messages to return. |
| `async` *Type: `Consumer<Result>`Default: n/a | `Consumer` of a `Result` of type `PNHistoryResult`. |

:::tip Using the reverse parameter:
Messages are always returned sorted in ascending time direction from history regardless of `reverse`. The `reverse` direction matters when you have more than 100 (or `count`, if it's set) messages in the time interval, in which case `reverse` determines the end of the time interval from which it should start retrieving the messages.
:::

### Sample code

Retrieve the last 100 messages on a channel:

```java
package com.pubnub.docs.messagePersistence;
// https://www.pubnub.com/docs/sdks/java/api-reference/storage-and-playback#history-paging-example

// snippet.historyPagingExampleDeprecated

import com.pubnub.api.PubNubException;
import com.pubnub.api.UserId;
import com.pubnub.api.java.PubNub;
import com.pubnub.api.java.v2.PNConfiguration;
import com.pubnub.api.models.consumer.history.PNHistoryItemResult;
import com.pubnub.api.models.consumer.history.PNHistoryResult;

import java.util.function.Consumer;

public class DeprecatedHistoryApp {
    public static void main(String[] args) {
        long timetokenOfLastMessage = 17_474_884_096_044_353L;
        String channel = "kotlin-ch1"; // Can only fetch history for one channel at a time.

        getAllMessages(channel, timetokenOfLastMessage + 1, 100, res -> {
            for (PNHistoryItemResult item : res.getMessages()) {
                System.out.println(item.getEntry().toString()); // your JSON payload
            }
        });
    }

    private static void getAllMessages(
            String channel,
            long startTimestamp,
            int count,
            Consumer<PNHistoryResult> callback
    ) {
        UserId userId;
        try {
            userId = new UserId("history-demo-user");
        } catch (PubNubException e) {
            throw new RuntimeException(e);
        }

        PNConfiguration config = PNConfiguration.builder(userId, "demo")
                .publishKey("demo")
                .build();

        PubNub pubnub = PubNub.create(config);

        pubnub.history()
                .channel(channel)
                .count(count)
                .start(startTimestamp)
                .reverse(false)
                .includeTimetoken(true)
                .async(result -> result
                        .onSuccess((PNHistoryResult res) -> {
                            if (!res.getMessages().isEmpty()) {
                                callback.accept(res);

                                // Recurse with newer start timestamp
                                long nextStart = res.getMessages().stream()
                                        .map(PNHistoryItemResult::getTimetoken)
                                        .filter(tt -> tt != null && tt > 0)
                                        .min(Long::compareTo)
                                        .orElse(startTimestamp);

                                // Stop recursion if no new earlier timetoken
                                if (nextStart < startTimestamp) {
                                    getAllMessages(channel, nextStart, count, callback);
                                }
                            }
                        })
                        .onFailure((PubNubException exception) -> {
                            System.err.println("Fetch error: " + exception.getMessage());
                        })
                );
    }
}
// snippet.end
```

### Returns

The `history()` operation returns a `PNHistoryResult` which contains the following operations:

| Method | Description |
| --- | --- |
| `getMessages()`Type: List`<PNHistoryItemResult>` | List of messages of type `PNHistoryItemResult`. See [PNHistoryItemResult](#pnhistoryitemresult) for more details. |
| `getStartTimetoken()`Type: Long | Start `timetoken`. |
| `getEndTimetoken()`Type: Long | End `timetoken`. |

#### PNHistoryItemResult

| Method | Description |
| --- | --- |
| `getTimetoken()`Type: Long | `Timetoken` of the message. |
| `getEntry()`Type: JsonElement | Message. |

### Other examples

#### Use history() to retrieve the three oldest messages by retrieving from the time line in reverse

```java
pubNub.history()
        .channel("my_channel") // where to fetch history from
        .count(3) // how many items to fetch
        .reverse(true) // should go in reverse?
        .async(result -> {
            result.onSuccess((PNHistoryResult res) -> {
                for (PNHistoryItemResult pnHistoryItemResult: res.getMessages()) {
                    pnHistoryItemResult.getEntry(); // custom JSON structure for message
                }
            });
        });
```

#### Use history() to retrieve messages newer than a given timetoken by paging from oldest message to newest message starting at a single point in time (exclusive)

```java
pubNub.history()
        .channel("my_channel") // where to fetch history from
        .start(13847168620721752L) // first timestamp
        .reverse(true) // should go in reverse?
        .async(result -> {
            result.onSuccess((PNHistoryResult res) -> {
                for (PNHistoryItemResult pnHistoryItemResult: res.getMessages()) {
                    pnHistoryItemResult.getEntry(); // custom JSON structure for message
                }
            });
        });
```

#### Use history() to retrieve messages until a given timetoken by paging from newest message to oldest message until a specific end point in time (inclusive)

```java
pubNub.history()
        .channel("my_channel") // where to fetch history from
        .count(100) // how many items to fetch
        .start(-1L) // first timestamp
        .end(13847168819178600L) // last timestamp
        .reverse(true) // should go in reverse?
        .async(result -> { /* check result */ });
```

#### History paging example

:::note Usage
You can call the method by passing 0 or a valid **timetoken** as the argument.
:::

```java
import com.pubnub.api.PubNubException;
import com.pubnub.api.UserId;
import com.pubnub.api.java.PubNub;
import com.pubnub.api.java.v2.PNConfiguration;
import com.pubnub.api.models.consumer.history.PNHistoryItemResult;
import com.pubnub.api.models.consumer.history.PNHistoryResult;

import java.util.function.Consumer;

public class DeprecatedHistoryApp {
    public static void main(String[] args) {
        long timetokenOfLastMessage = 17_474_884_096_044_353L;
        String channel = "kotlin-ch1"; // Can only fetch history for one channel at a time.

        getAllMessages(channel, timetokenOfLastMessage + 1, 100, res -> {
            for (PNHistoryItemResult item : res.getMessages()) {
                System.out.println(item.getEntry().toString()); // your JSON payload
            }
        });
    }

    private static void getAllMessages(
            String channel,
            long startTimestamp,
            int count,
            Consumer<PNHistoryResult> callback
    ) {
        UserId userId;
        try {
            userId = new UserId("history-demo-user");
        } catch (PubNubException e) {
            throw new RuntimeException(e);
        }

        PNConfiguration config = PNConfiguration.builder(userId, "demo")
                .publishKey("demo")
                .build();

        PubNub pubnub = PubNub.create(config);

        pubnub.history()
                .channel(channel)
                .count(count)
                .start(startTimestamp)
                .reverse(false)
                .includeTimetoken(true)
                .async(result -> result
                        .onSuccess((PNHistoryResult res) -> {
                            if (!res.getMessages().isEmpty()) {
                                callback.accept(res);

                                // Recurse with newer start timestamp
                                long nextStart = res.getMessages().stream()
                                        .map(PNHistoryItemResult::getTimetoken)
                                        .filter(tt -> tt != null && tt > 0)
                                        .min(Long::compareTo)
                                        .orElse(startTimestamp);

                                // Stop recursion if no new earlier timetoken
                                if (nextStart < startTimestamp) {
                                    getAllMessages(channel, nextStart, count, callback);
                                }
                            }
                        })
                        .onFailure((PubNubException exception) -> {
                            System.err.println("Fetch error: " + exception.getMessage());
                        })
                );
    }
}
```

#### Include timetoken in history

```java
pubNub.history()
        .channel("history_channel") // where to fetch history from
        .count(100) // how many items to fetch
        .includeTimetoken(true) // include timetoken with each entry
        .async(result -> { /* check result */ });
```

## Terms in this document

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