In a recent question someone pointed out that the Firebase pricing documentation states:
REST API requests don't count towards your connection limits
I understand (and appreciate) this statement for what it seems meant for: GET, PUT, POST and DELETE requests against the REST API are typically used for non-real-time operations on the data, such as downloading the data for back-up or bulk calculations. These are typically infrequent, relatively short-lived operations and in general should dwarf the number of real-time data connections.
But that is different when we look at Firebase's REST streaming API. Unlike the rest of the REST API, the streaming is clearly intended for real-time data connections.
According to the documentation quoted above, these connections should not count against the connection limit. But according to a comment by a Firebase developer on Google Groups:
concurrent [connections] are real-time clients or streamed REST
The part I emphasized seems to suggest that clients using the streaming REST API do count against the connection limit.
To test, I wrote a small C# client that uses the Firebase REST streaming API to monitor a node:
var url = "https://<my>.firebaseio.com/clock/.json";
var client = new WebClient();
client.Headers["Accept"] = "text/event-stream";
using (var stream = client.OpenRead(url)) {
using (var reader = new StreamReader(stream)) {
string line = null;
while (null != (line = reader.ReadLine())) {
(DateTime.Now.ToShortTimeString() + line).Dump();
}
}
}
About 15 minutes after starting this program the concurrent connections in my Firebase dashboard indeed went up by 1. Running a second instance, increased the concurrent connection count in the dashboard again.
So this test seems to confirm what was hinted at on Google Groups: REST streaming clients count as a concurrent connection. Can someone confirm this or spot a flaw in my test?
Your assumptions here are correct. Streaming calls via the REST API do count against your concurrents count as they logically should (i.e. they are holding open a socket connection and creating additional load). Non-streaming calls against the REST API do not count as concurrent connections.
I'll have a look at the pricing page and see if we can make the text a bit clearer.