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
Marc Porst 8Marc Porst 8 

Streaming client timeout

Hi, we created a Streaming client in Python. We use the package SalesforceStreamingClient from aiosfstream for this:

Documentation (https://aiosfstream.readthedocs.io/_/downloads/en/latest/pdf/)

We subscribe to a Platform Event.
Sometimes it happens the streaming client stops receiving any messages. After we restart the Python application everything works fine again. 

 

I have read there is an connection timeout for the Streaming API (CometD) for 3 hours. 

 

But as you can see the graph it works for a whole day and then suddenly stops.

 

NewRelic


Do we have to reset the connect after not receiving any messages within a time period or can we check with a timer if we are still listening to the PlatformEvent?

 

Thanks,

 

Marc

Best Answer chosen by Marc Porst 8
VinayVinay (Salesforce Developers) 
Hi Marc,

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/213107/platform-events-length-of-time-an-event-is-published-for

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Marc,

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/213107/platform-events-length-of-time-an-event-is-published-for

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
This was selected as the best answer
Marc Porst 8Marc Porst 8
Hi Vinay, thanks for your answer

Marc