Add api/common_api.php and use Server-Sent Events, streaming JSON
data on like the overview page to update the User/Channel/.. counts
instead of doing a HTTP request every second like we had before.
The use of api/common_api.php from api/ is quite easy:
require_once('common_api.php');
which takes care of validating the session, closing the session,
disabling output buffering, etc.
And then you use either:
* api_log_loop($sources)
like: api_log_loop(["connect"]);
Or:
* api_timer_loop((int $every_msec, string $method, array|null $params = null)
like: api_timer_loop(1000, "stats.get");
And then all the (streaming) JSON-RPC response data from the server is
streamed back to the client via SSE.