+ Start a Discussion
zgcharley_09zgcharley_09 

Streaming API, does salesforce server disconnect client after some time?

Hi all,

For streaming API, does server force disconnect client after some time? If true, then how long the time is?

Didn't find any documentation about this, but sometimes we client can't receive notification anymore. 
zgcharley_09zgcharley_09
[supplement]
And when initially connect to Salesforce streaming, the response looks like:
{"clientId":"xxx","advice":{"interval":0,"timeout":110000,"reconnect":"retry"},"channel":"/meta/connect","successful":true}
What does the "timeout":110000 here mean? Does it mean after 110000 seconds, client need start over again handshake?

 
zgcharley_09zgcharley_09
After reading bayeux protocol spec, get to know about this "timeout", it's ms not seconds. 
 
timeout advice field
An integer representing the period of time, in milliseconds, for the server to delay responses to the /meta/connect channel.

And also based on the oberservation, Salesforce indeed deplay a response around 110 seconds for each client re-connect. 
2018/07/06 10:41:29.297785 Response Body: [{"clientId":"xxx","channel":"/meta/connect","successful":true}]
---reconnect call ---  

2018/07/06 10:43:19.490729 Response Body: [{"clientId":"xxx","channel":"/meta/connect","successful":true}]
---reconnect call ---  

2018/07/06 10:45:09.773423 Response Body: [{"clientId":"xxx","channel":"/meta/connect","successful":true}]
---reconnect call ---  

2018/07/06 10:46:59.962616  Response Body: [{"clientId":"xx","channel":"/meta/connect","successful":true}]
---reconnect call ---


May i thinking like this:  if assuming network is 100% good, then the long-connection to server will never be interruppted? The server disconnect a client because of network issue or server itselft run into error? 

 

Can some experts explain more for this?