View Counts

This service manages the live event's count of concurrent viewers.

The client implementation should hit the increment view count route once per second to register the client as a viewer. If the client doesn't hit the increment view count route every one-second interval, Reactive will assume the viewer is no longer watching and decrease the stream's view count. Follow our guide to sync your client's clock with Reactive's servers and make requests at the correct intervals.

Each route requires that requests authenticate with a Reactive JWT Token. Refer to our authentication documentation for how to get and use a Reactive JWT Token.

Increment view count

This increments the view count for your stream for 1 second. Your client must post to this route once per second while connected to the stream.

Request:

POST https://view-counts.reactive.live/api/v1/view-counts/:stream_id

Parameters:

Name Type Required Description
stream_id string Yes The id of the stream you'd like to register as a viewer for

Example command:

curl -X POST \
    -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpcCI6IjEwNC4xNjIuOTcuMjgiLCJhdWQiOiI2OTM1MzU3YS04ZDcxLTQ1ZjItOWEwZi1kZGFlZDcwNWI0M2EiLCJzdWIiOiJBQjM1NDU3YS04ZDcxLTQ1ZjItQkUyRi1kZGFlZDcwNWI0M2EiLCJpc3MiOiJSZWFjdGl2ZSIsImlhdCI6MTYzNDkzNTQ5NCwiZXhwIjoxNjM0OTM2MDk0LCJqdGkiOiIwNzRlNDA0MS02MDg0LTQyOTItOTk2MC1jMTBlNWE1YzAwMjgifQ.o-pkrvzbTSVlzGixknSQvX1cwH1UIpx3R_fzmMpn3R8" \
    https://view-counts.reactive.live/api/v1/view-counts/6935357a-8d71-45f2-9a0f-ddaed705b43a

Response:

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{"value":1}