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 Answer 1

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

5
  • 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 ?? Feb 19, 2018 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." Feb 19, 2018 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, 2018 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. Feb 19, 2018 at 11:08
  • cool! once you done, let me know :)
    – user11
    Feb 19, 2018 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .