I'm unable to subscribe to topics using OAuth based connections unless I perform a query first.
The following code never gets a message:
var salesforceConnection = new jsforce.Connection({
instanceUrl: salesforceInstanceUrl,
oauth2: {
clientId: salesforceClientId,
clientSecret: salesforceClientSecret,
loginUrl: salesforceLoginUrl
},
refreshToken: salesforceRefreshToken
});
salesforceConnection.streaming.topic('Topic').subscribe(function(message) {
console.log(message);
});
The following is my workaround:
var salesforceConnection = new jsforce.Connection({
instanceUrl: salesforceInstanceUrl,
oauth2: {
clientId: salesforceClientId,
clientSecret: salesforceClientSecret,
loginUrl: salesforceLoginUrl
},
refreshToken: salesforceRefreshToken
});
salesforceConnection.describe('Custom__c', function() {
salesforceConnection.streaming.topic('Topic').subscribe(function(message) {
console.log(message);
});
});
Are you not setting access token to connection constructor ? If so it will always refresh to obtain access token, and currently auto-token-refresh is implemented for REST apis only.
Yes, I'm expecting the connection to obtain the access token based on the refreshToken which is why we're not specifying accessToken in the constructor.
Does your response mean that when our access token expires that our connection to the streaming topic will silently fail and never recover?
Does your response mean that when our access token expires that our connection to the streaming topic will silently fail and never recover?
Failure reporting is not provided. In future auto refresh might be supported for streaming client, but currently not.
Thanks @stomita. We really love the jsforce project. Is there anyway we could sponsor your development of auto-refresh and auto-reconnect of dropped streaming client connections?
In general you can fork the repository and create a pull request for the features you want to feedback to the project. I'm not sure I can merge it, but that will be a starting point I think.
@freshlogic Additionally there're test codes for all functions in the project so it is very appreciated to attach test codes for your added features when you are sending a pull request.
@stomita I am facing the same issue . I am not able to get the events .
Can we subscribe to topics and does jsforce refreshes its token automatically for streaming apis.
@freshlogic is there any latest update on this ?
@stomita @freshlogic
Does auto-refresh and auto-reconnect of dropped streaming client connections are supported?
Most helpful comment
@stomita I am facing the same issue . I am not able to get the events .
Can we subscribe to topics and does jsforce refreshes its token automatically for streaming apis.
@freshlogic is there any latest update on this ?