From 9236ea0fc14af2041b2e5a82ad1e3f2df234e519 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Thu, 22 Feb 2024 17:46:53 +0530 Subject: [PATCH] Refactored code as per review comments --- lib/src/platform/src/realtime/connection.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/src/platform/src/realtime/connection.dart b/lib/src/platform/src/realtime/connection.dart index 544b02208..383c09e1f 100644 --- a/lib/src/platform/src/realtime/connection.dart +++ b/lib/src/platform/src/realtime/connection.dart @@ -40,6 +40,11 @@ class Connection extends PlatformObject { /// member. String? id; + /// fetchId returns unique public identifier for this connection. + /// used to identify this member. + Future fetchId() => + invoke(PlatformMethod.connectionId); + /// A unique private connection key used to recover or resume a connection, /// assigned by Ably. /// @@ -49,7 +54,19 @@ class Connection extends PlatformObject { /// to publish on behalf of this client. See the /// [publishing over REST on behalf of a realtime client docs](https://ably.com/docs/rest/channels#publish-on-behalf) /// for more info. - Future get key => invoke(PlatformMethod.connectionKey); + String? key; + + /// fetchKey returns a unique private connection key used to recover + /// or resume a connection, assigned by Ably. + /// + /// When recovering a connection explicitly, the `recoveryKey` is used in the + /// recover client options as it contains both the key and the last message + /// serial. This private connection key can also be used by other REST clients + /// to publish on behalf of this client. See the + /// [publishing over REST on behalf of a realtime client docs](https://ably.com/docs/rest/channels#publish-on-behalf) + /// for more info. + Future fetchKey() => + invoke(PlatformMethod.connectionKey); /// The recovery key string can be used by another client to recover this /// connection's state in the recover client options property.