0

Sample code how I'm initializing LongPollingTransport to create Bayeux client for subscribing pushtopic ,

LongPollingTransport transport = new LongPollingTransport(options,
            httpClient) {
                @Override
                protected void customize(Request request) {
                    request.header("Authorization", "OAuth " + accessToken);
                }
    };

On every connection session timeout I'm creating new connection and getting access token from it. Now my question is do I need to re initialize the LongPollingTransport as well as it has request parameter having old access token ??

1

In the case of server timeouts, the client connects again and starts over.

Reference > https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/BayeauxProtocolAndCometD.htm

  • Hi Dinesh, Thanks for your response. So according to the link you provided ,we must restart the client and re subscribe to events on session timeout right ?? – Dipankar Dey Feb 19 '18 at 10:19
  • One more query , can you exaplain the following which I got from the link you provided , "Invalidated client authentication doesn’t include Salesforce session expiration. The Salesforce session never expires in a CometD client. Salesforce keeps extending the timeout interval as long as the client stays connected." – Dipankar Dey Feb 19 '18 at 10:22
  • It states like it will reconnect automatically, May be this example might help you have a look at it github.com/forcedotcom/EMP-Connector/blob/master/src/main/java/… – user11 Feb 19 '18 at 10:27
  • I haven't used emp libraries in my solution but anyways thaks for your help.So I will assume that the correct way is to restart the client on session timeout. – Dipankar Dey Feb 19 '18 at 11:08
  • cool! once you done, let me know :) – user11 Feb 19 '18 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.