Skip to content

Commit e19acc3

Browse files
Merge pull request #6 from ably/add-connected-protocolmessage-api
Add LiveObjects plugin API for receiving connection details
2 parents 3989f34 + c034504 commit e19acc3

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@import Foundation;
2+
3+
NS_ASSUME_NONNULL_BEGIN
4+
5+
NS_SWIFT_NAME(ConnectionDetailsProtocol)
6+
NS_SWIFT_SENDABLE
7+
/// The contents of a `CONNECTED` `ProtocolMessage`'s `connectionDetails`.
8+
@protocol APConnectionDetailsProtocol
9+
10+
/// Wraps an `NSTimeInterval` containing the `objectsGCGracePeriod`, if any, in seconds.
11+
@property (nonatomic, readonly, nullable) NSNumber *objectsGCGracePeriod;
12+
13+
@end
14+
15+
NS_ASSUME_NONNULL_END

Sources/_AblyPluginSupportPrivate/include/APLiveObjectsPlugin.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@protocol APRealtimeChannel;
88
@protocol APRealtimeClient;
99
@protocol APPublicErrorInfo;
10+
@protocol APConnectionDetailsProtocol;
1011

1112
NS_ASSUME_NONNULL_BEGIN
1213

@@ -83,6 +84,13 @@ NS_SWIFT_SENDABLE
8384
protocolMessageChannelSerial:(nullable NSString *)protocolMessageChannelSerial
8485
channel:(id<APRealtimeChannel>)channel;
8586

87+
/// Called whenever the client receives a `CONNECTED` `ProtocolMessage`, passing its `connectionDetails` (if any).
88+
///
89+
/// Parameters:
90+
/// - channel: The channel that should be informed about the connection details.
91+
- (void)nosync_onConnectedWithConnectionDetails:(nullable id<APConnectionDetailsProtocol>)connectionDetails
92+
channel:(id<APRealtimeChannel>)channel;
93+
8694
@end
8795

8896
/// An `ObjectMessage`, as found in the `state` property of an `OBJECT` or `OBJECT_SYNC` `ProtocolMessage`.

Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ NS_SWIFT_SENDABLE
8080
- (void)nosync_fetchServerTimeForClient:(id<APRealtimeClient>)client
8181
completion:(void (^ _Nullable)(NSDate *_Nullable serverTime, _Nullable id<APPublicErrorInfo> error))completion;
8282

83+
/// The `connectionDetails` from the latest `CONNECTED` `ProtocolMessage` that the client received (`nil` if it did not contain a `connectionDetails`).
84+
- (nullable id<APConnectionDetailsProtocol>)nosync_latestConnectionDetailsForClient:(id<APRealtimeClient>)client;
85+
8386
/// Logs a message to a logger.
8487
- (void)log:(NSString *)message
8588
withLevel:(APLogLevel)level

0 commit comments

Comments
 (0)