function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohit_BatraMohit_Batra 

How long does a connection last in Salesforce Streaming API

Hi Devs

We have implemented the Salesforce Streaming API in .net using LongPooling and Bayeux cient.

But we are seeing that connection getting lost after 48 hours

So my question is, how long does a connection last using the above protocols??
And is there a way we can have a long connection with Salesforce without any hinderence

Any help would be appreciated.

Thanks
VinayVinay (Salesforce Developers) 
Hi Mohit,

Streaming API doesn’t guarantee durability and reliable delivery of notifications. Streaming servers don’t maintain any client state and don’t keep track of what’s delivered. The client may not receive messages for a variety of reasons, including: - When a client first subscribes or reconnects, it doesn’t receive messages that were processed while it wasn’t subscribed to the channel. - If a client disconnects and starts a new handshake, it may be working with a different application server, so it receives only new messages from that point on. Some events may be dropped if the system is being heavily used. - If an application server is stopped, all the messages being processed but not yet sent are lost. Any clients connected to that application server are disconnected. To receive notifications, the client must reconnect and subscribe to the topic channel.

Reference:
https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/intro_stream.htm
https://salesforce.stackexchange.com/questions/53522/streaming-api-channel-getting-disconnected-after-certain-interval
https://salesforce.stackexchange.com/questions/213107/platform-events-length-of-time-an-event-is-published-for

Thanks,
Mohit_BatraMohit_Batra
Thanks Vinay.

So that means, we have only one solution to connect to the client again???
VinayVinay (Salesforce Developers) 
Yes and hope above information was helpful.

Thanks,