Emitted when the Device's token is about to expire. Use DeviceOptions.refreshTokenMs to set a custom warning time. Default is 10000 (10 seconds) prior to the token expiring.
device.on('tokenWillExpire', device => { const token = getNewTokenViaAjax(); device.updateToken(token);}); Copy
device.on('tokenWillExpire', device => { const token = getNewTokenViaAjax(); device.updateToken(token);});
Emitted when the Device's token is about to expire. Use DeviceOptions.refreshTokenMs to set a custom warning time. Default is 10000 (10 seconds) prior to the token expiring.