Get message details
Get message details, retrieve content, and check if the message was deleted.
Get message details
getMessage() fetches the Message object from Message Persistence based on the message timetoken.
Method signature
This method takes the following parameters:
1channel.getMessage(
2 timetoken: Timetoken
3) async throws -> MessageImpl?
Input
| Parameter | Description |
|---|---|
timetoken *Type: TimetokenDefault: n/a | Timetoken of the message you want to retrieve from Message Persistence. |
Output
| Parameter | Description |
|---|---|
MessageImpl | Returned Message object. |
Sample code
Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
Get the message with the 16200000000000001 timetoken.
1
Get historical details
With Message Persistence enabled, PubNub stores all historical message data, metadata, and actions.
Fetch historical message details with getHistory(). By default, all message actions and metadata are included in the response.
Get message content
Access the text content of a Message object using the text property.
Sample code
Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
Get the content of the message with the 16200000000000000 timetoken.
1
Check deletion status
Check if a Message object was soft-deleted using the deleted property.
Sample code
Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
Get the status of the message with the 16200000000000000 timetoken.
1