Skip to content

Sinks

HTTP sink

The HTTP sink batches release-health events and posts them as JSON to any endpoint you control, with buffering and retry.

@release-health/sink-http batches release-health events and posts them as JSON to any endpoint you control. It is the simplest way to get the event stream off the device and into your own backend.

Install

npm install @release-health/sink-http react-native-release-health

Usage

import { ReleaseHealth } from 'react-native-release-health';
import { httpSink } from '@release-health/sink-http';
 
ReleaseHealth.init({
  adapter: yourAdapter,
  sinks: [
    httpSink({
      url: 'https://telemetry.example.com/release-health',
      headers: { authorization: 'Bearer <token>' },
    }),
  ],
});

Events are buffered and sent as POST requests with the body { "events": [...] }. Any 2xx response acknowledges the batch; failed requests keep their events buffered (up to maxBufferedEvents, oldest dropped first) and retry on the next flush.

Options

OptionDefaultDescription
urlrequiredEndpoint receiving the JSON batches
headers{}Extra request headers
batchSize20Send as soon as this many events are buffered
flushIntervalMs5000Send buffered events at most this often
maxBufferedEvents500Buffer cap while the endpoint is unreachable
fetchImplglobal fetchAlternative fetch implementation

Local development

The monorepo ships a tiny receiver for local testing:

yarn receiver
# then point the sink at http://localhost:8787/events
# (Android emulator: http://10.0.2.2:8787/events)

The shape of each event is documented on Events and failure detection.