Constructor for an auth failure detector extension
Based on new feature released with Salesforce Spring '18: https://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/rn_messaging_cometd_auth_validation.htm?edition=&impact=
Example triggering error message:
{ "ext":{ "sfdc":{"failureReason":"401::Authentication invalid"}, "replay":true}, "advice":{"reconnect":"none"}, "channel":"/meta/handshake", "error":"403::Handshake denied", "successful":false} Copy
{ "ext":{ "sfdc":{"failureReason":"401::Authentication invalid"}, "replay":true}, "advice":{"reconnect":"none"}, "channel":"/meta/handshake", "error":"403::Handshake denied", "successful":false}
Example usage:
const jsforce = require('jsforce');const { StreamingExtension } = require('jsforce/api/streaming');const conn = new jsforce.Connection({ … });const channel = "/event/My_Event__e";// Exit the Node process when auth failsconst exitCallback = () => process.exit(1);const authFailureExt = new StreamingExtension.AuthFailure(exitCallback);const fayeClient = conn.streaming.createClient([ authFailureExt ]);const subscription = fayeClient.subscribe(channel, data => { console.log('topic received data', data);});subscription.cancel(); Copy
const jsforce = require('jsforce');const { StreamingExtension } = require('jsforce/api/streaming');const conn = new jsforce.Connection({ … });const channel = "/event/My_Event__e";// Exit the Node process when auth failsconst exitCallback = () => process.exit(1);const authFailureExt = new StreamingExtension.AuthFailure(exitCallback);const fayeClient = conn.streaming.createClient([ authFailureExt ]);const subscription = fayeClient.subscribe(channel, data => { console.log('topic received data', data);});subscription.cancel();
Invoked when authentication becomes invalid
Constructor for an auth failure detector extension
Based on new feature released with Salesforce Spring '18: https://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/rn_messaging_cometd_auth_validation.htm?edition=&impact=
Example triggering error message:
Example usage:
Param: failureCallback
Invoked when authentication becomes invalid