File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,9 +130,6 @@ export interface MqttConnectionConfig extends mqtt_shared.MqttConnectionConfigBa
130130
131131 /** Options for the underlying credentials provider */
132132 credentials_provider ?: auth . CredentialsProvider ;
133-
134- /** Optional metrics configuration to be applied to the username and sent with the CONNECT packet */
135- sdkMetrics ?: mqtt_shared . AwsIoTDeviceSDKMetrics ;
136133}
137134
138135/**
@@ -247,7 +244,13 @@ export class MqttClientConnection extends BufferedEventEmitter {
247244 internalConnectOptions . clientId = this . config . client_id ;
248245 }
249246
250- internalConnectOptions . username = mqtt_shared_browser . buildFinalUsernameFromMetrics ( this . config . sdkMetrics ?? new mqtt_shared . AwsIoTDeviceSDKMetrics ( ) , this . config . username ) ;
247+ if ( this . config . disable_metrics ) {
248+ if ( this . config . username ) {
249+ internalConnectOptions . username = this . config . username ;
250+ }
251+ } else {
252+ internalConnectOptions . username = mqtt_shared_browser . buildFinalUsernameFromMetrics ( new mqtt_shared . AwsIoTDeviceSDKMetrics ( ) , this . config . username ) ;
253+ }
251254
252255 if ( this . config . password ) {
253256 internalConnectOptions . password = mqtt_shared_browser . normalize_payload_to_buffer ( this . config . password ) ;
Original file line number Diff line number Diff line change @@ -144,9 +144,6 @@ export interface Mqtt5ClientConfig extends mqtt_shared.Mqtt5ClientConfigBase {
144144 * @group Browser-only
145145 */
146146 websocketOptions ?: Mqtt5WebsocketConfig ;
147-
148- /** Optional metrics configuration to be applied to the username and sent with the CONNECT packet */
149- sdkMetrics ?: mqtt_shared . AwsIoTDeviceSDKMetrics ;
150147}
151148
152149function convertSessionBehaviorToSessionPolicy ( behavior ?: mqtt5 . ClientSessionBehavior ) : internal_mqtt_client . ResumeSessionPolicyType {
@@ -167,7 +164,15 @@ function convertSessionBehaviorToSessionPolicy(behavior?: mqtt5.ClientSessionBeh
167164}
168165
169166function buildInternalConnectOptions ( internalConnectOptions : internal_mqtt_client . ConnectOptions , clientConfig : Mqtt5ClientConfig , connectProperties ?: mqtt5_packet . ConnectPacket ) {
170- internalConnectOptions . username = mqtt_shared_browser . buildFinalUsernameFromMetrics ( clientConfig . sdkMetrics ?? new mqtt_shared . AwsIoTDeviceSDKMetrics ( ) , connectProperties ?. username ) ;
167+ if ( clientConfig . disableMetrics ) {
168+ if ( connectProperties ?. username ) {
169+ internalConnectOptions . username = connectProperties . username ;
170+ }
171+ } else {
172+ internalConnectOptions . username = mqtt_shared_browser . buildFinalUsernameFromMetrics ( new mqtt_shared . AwsIoTDeviceSDKMetrics ( ) , connectProperties ?. username ) ;
173+ }
174+
175+ internalConnectOptions . username = mqtt_shared_browser . buildFinalUsernameFromMetrics ( new mqtt_shared . AwsIoTDeviceSDKMetrics ( ) , connectProperties ?. username ) ;
171176
172177 if ( ! connectProperties ) {
173178 return ;
Original file line number Diff line number Diff line change @@ -343,5 +343,10 @@ export interface Mqtt5ClientConfigBase {
343343 * If this setting is left undefined, then topic aliasing behavior will be disabled.
344344 */
345345 topicAliasingOptions ? : mqtt5 . TopicAliasingOptions ;
346+
347+ /**
348+ * Options for disable Aws IoT Metrics. The metrics includes SDK name, version, and platform.
349+ */
350+ disableMetrics ? : boolean ;
346351}
347352
Original file line number Diff line number Diff line change @@ -206,13 +206,6 @@ export interface Mqtt5ClientConfig extends mqtt_shared.Mqtt5ClientConfigBase {
206206 * @group Node-only
207207 */
208208 extendedValidationAndFlowControlOptions ? : ClientExtendedValidationAndFlowControl ;
209-
210- /**
211- * Options for disable Aws IoT Metrics. The metrics includes SDK name, version, and platform.
212- *
213- * @group Node-only
214- */
215- disableMetrics ? : boolean ;
216209}
217210
218211/**
You can’t perform that action at this time.
0 commit comments