File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -234,12 +234,12 @@ class ArduinoClientMqtt {
234234
235235 // Re-subscribe to all topics subscribed before the reconnection
236236 Object . values ( this . subscribedTopics ) . forEach ( ( subscribeParams ) => {
237- subscribe ( subscribeParams . topic , subscribeParams . cb ) ;
237+ this . subscribe ( subscribeParams . topic , subscribeParams . cb ) ;
238238 } ) ;
239239
240- if ( typeof this . connectionOptions . onConnected === 'function' ) {
240+ if ( typeof this . opts . onConnected === 'function' ) {
241241 // Call the connection callback (with the reconnection param set to true)
242- this . connectionOptions . onConnected ( true ) ;
242+ this . opts . onConnected ( true ) ;
243243 }
244244
245245 // Exit the infinite loop
Original file line number Diff line number Diff line change @@ -175,12 +175,14 @@ function findUser(clientId) {
175175
176176async function updateToken ( connectionConfig ) {
177177 try {
178- var user = findUser ( clientId ) ;
178+ var user = findUser ( connectionConfig . credentials . clientid ) ;
179179 if ( user !== - 1 ) {
180180 var tokenInfo = await getToken ( connectionConfig ) ;
181181 if ( tokenInfo !== undefined ) {
182182 connections [ user ] . token = tokenInfo . token ;
183183 connections [ user ] . expires_token_ts = tokenInfo . expires_in ;
184+ connections [ user ] . clientMqtt . updateToken ( tokenInfo . token ) ;
185+ connections [ user ] . clientHttp . updateToken ( tokenInfo . token ) ;
184186 connections [ user ] . timeoutUpdateToken = setTimeout ( ( ) => { updateToken ( connectionConfig ) } , tokenInfo . expires_in * 1000 ) ;
185187 } else {
186188 connections [ user ] . timeoutUpdateToken = setTimeout ( ( ) => { updateToken ( connectionConfig ) } , 1000 ) ;
You can’t perform that action at this time.
0 commit comments