diff --git a/Source/ARTClientInformation.m b/Source/ARTClientInformation.m index 9d7b6db3f..878c1c551 100644 --- a/Source/ARTClientInformation.m +++ b/Source/ARTClientInformation.m @@ -31,7 +31,7 @@ + (NSString *)agentIdentifierWithAdditionalAgents:(nullable NSDictionary *resolvedParams = options.params ? [options.params mutableCopy] : [NSMutableDictionary dictionary]; + if (self.options.agents) { + resolvedParams[@"agent"] = [ARTClientInformation agentIdentifierForAgents:self.options.agents]; + } + + ARTRealtimeChannelOptions *resolvedOptions = options ? [options copy] : [[ARTRealtimeChannelOptions alloc] init]; + resolvedOptions.params = resolvedParams; + + return resolvedOptions; +} + - (ARTRealtimeWrapperSDKChannelProxy *)get:(NSString *)name { - ARTRealtimeChannel *channel = [self.channels get:name]; + ARTRealtimeChannel *channel = [self.channels get:name + options:[self addingAgentToOptions:nil]]; // TODO reuse existing instance return [[ARTRealtimeWrapperSDKChannelProxy alloc] initWithChannel:channel options:self.options]; @@ -156,7 +171,7 @@ - (ARTRealtimeWrapperSDKChannelProxy *)get:(NSString *)name { - (ARTRealtimeWrapperSDKChannelProxy *)get:(NSString *)name options:(ARTRealtimeChannelOptions *)options { ARTRealtimeChannel *channel = [self.channels get:name - options:options]; + options:[self addingAgentToOptions:options]]; // TODO reuse existing instance return [[ARTRealtimeWrapperSDKChannelProxy alloc] initWithChannel:channel options:self.options]; diff --git a/Source/PrivateHeaders/Ably/ARTClientInformation+Private.h b/Source/PrivateHeaders/Ably/ARTClientInformation+Private.h index 981840cc0..125c97f84 100644 --- a/Source/PrivateHeaders/Ably/ARTClientInformation+Private.h +++ b/Source/PrivateHeaders/Ably/ARTClientInformation+Private.h @@ -9,6 +9,9 @@ extern NSString *const ARTClientInformation_libraryVersion; + (NSString *)libraryAgentIdentifier; + (NSString *)platformAgentIdentifier; +// The resulting string only includes the given agents; it does not insert any default agents. ++ (NSString *)agentIdentifierForAgents:(NSDictionary *)agents; + @end NS_ASSUME_NONNULL_END