Utility Methods API for PubNub Rust SDK
The methods on this page are utility methods that don't fit into other categories.
Disconnect
Disconnect from PubNub and pause listening for real-time updates from all data streams. Disconnecting may be temporary and is reversible by reconnecting. When you disconnect, a cursor of the last received message is saved.
Client scope
This method is only available on the PubNub object.
Method(s)
pubnub.disconnect()
Basic Usage
pubnub.disconnect();
Returns
None
Reconnect
Reconnect to PubNub and resume listening for real-time updates from all data streams. The cursor of the last received message is used for message catch-up between the time you disconnected and reconnected.
Client scope
This method is only available on the PubNub object.
Method(s)
pubnub.reconnect(cursor: Option<SubscriptionCursor>)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
cursor | Option<SubscriptionCursor> | Yes | Cursor of the last received message before disconnect() was called | Cursor from which to return any available cached messages. Message retrieval with cursor is not guaranteed and should only be considered a best-effort service. A cursor consists of a timetoken and region: SubscriptionCursor{timetoken: String, region: u32} Pass None if not needed. |
Basic Usage
pubnub.reconnect(None);
Returns
None