Streaming API - Concurrent Connections

I’m trying to understand what it means when reading the doc’s for the streaming API’s

https://developer-specs.company-information.service.gov.uk/streaming-api/guides/overview

Connection limits

A maximum of two concurrent connections per-account can be made to the streaming API. Each additional connection attempt above this limit will cause the oldest open connection to close.

Be aware that repeatedly opening connections to the streaming API will result in the client being rate limited.

Does that mean we can only connect to 2 streaming API’s at any one a time, even though there are 6 in total?

2 Likes

After spending way too long on this, I think this is the route cause of my problem.
Originally I thought the heartbeat was making my python script crash as I kept getting a ChunkedEncodingError with zero bytes, but this connection limit is closing the connections when I’m listening to all the streams.
Works great when only 2 streams are connected.

Has this always been the case?
I’ve seen a git repo that listens to all the channels at the same time.

Also, in the docs - Streaming API:, it says “Repeatedly reconnecting to the streaming API is a resource expensive operation, and you may be rate-limited if you do this frequently.”
Surely limiting concurrent connections to 2 when there is 6 streams in total will force people to repeatedly connect, going against what you are asking?

Nope. This changed sometime at the start of the year. I had all 6 running through development then suddenly, months after going into production and having worked through and around the issues with the ‘fluid specifications’, the limits were imposed / enforced. This made my app fairly un-useable for the purposes I’d developed it for. Very frustrating.

@phillip Well that sucks

How often do the @staff at Companies House frequent these forums?
I’d be interested to know the thought process and reasoning behind capping it at 2?

They are always here! And yes, they have eyes on this already.
PS: I’d also like to understand the thinking behind this - on the face of it, makes no sense at all apart from maybe keeping an eye on their outgoing bandwidth.