Skip to content

Commit

Permalink
fix: topicAliasMaximum under must be under Connect properties (#1519)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoanBrand authored Jun 23, 2023
1 parent 85c9341 commit 3b2e1cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function MqttClient (streamBuilder, options) {
debug('MqttClient :: options.keepalive', options.keepalive)
debug('MqttClient :: options.reconnectPeriod', options.reconnectPeriod)
debug('MqttClient :: options.rejectUnauthorized', options.rejectUnauthorized)
debug('MqttClient :: options.topicAliasMaximum', options.topicAliasMaximum)
debug('MqttClient :: options.properties.topicAliasMaximum', options.properties.topicAliasMaximum)

this.options.clientId = (typeof options.clientId === 'string') ? options.clientId : defaultId()

Expand Down Expand Up @@ -320,11 +320,11 @@ function MqttClient (streamBuilder, options) {
// True if connection is first time.
this._firstConnection = true

if (options.topicAliasMaximum > 0) {
if (options.topicAliasMaximum > 0xffff) {
debug('MqttClient :: options.topicAliasMaximum is out of range')
if (options.properties && options.properties.topicAliasMaximum > 0) {
if (options.properties.topicAliasMaximum > 0xffff) {
debug('MqttClient :: options.properties.topicAliasMaximum is out of range')
} else {
this.topicAliasRecv = new TopicAliasRecv(options.topicAliasMaximum)
this.topicAliasRecv = new TopicAliasRecv(options.properties.topicAliasMaximum)
}
}

Expand Down

0 comments on commit 3b2e1cb

Please sign in to comment.