Content Watcher Service
The Content Watcher Service monitors and retrieves the latest feed state, including content updates, reactions, and other user interactions on the Frequency network. It ensures that applications can stay up-to-date with the latest content and user activity.
API Reference
Configuration
âšī¸ Feel free to adjust your environment variables to taste. This application recognizes the following environment variables:
Name | Description | Range/Type | Required? | Default |
---|---|---|---|---|
API_BODY_JSON_LIMIT | Api json body size limit in string (some examples: 100kb or 5mb or etc) | string | 1mb | |
API_PORT | HTTP port that the application listens on | 1025 - 65535 | 3000 | |
API_TIMEOUT_MS | Overall API timeout limit in milliseconds. This is the maximum time allowed for any API request to complete. Any HTTP_RESPONSE_TIMEOUT_MS value must be less than this value | > 0 | 30000 | |
BLOCKCHAIN_SCAN_INTERVAL_SECONDS | How many seconds to delay between successive scans of the chain for new content (after end of chain is reached) | > 0 | 12 | |
CACHE_KEY_PREFIX | Prefix to use for Redis cache keys | string | content-watcher: | |
DEBUG | Enable additional logging | 'true' for debug logs, 'verbose' for debug + verbose logs | N | false |
FREQUENCY_API_WS_URL | Blockchain API Websocket URL | ws(s): URL | Y | |
FREQUENCY_TIMEOUT_SECS | Frequency chain connection timeout limit; app will terminate if disconnected longer | integer | 10 | |
IPFS_BASIC_AUTH_SECRET | If required for read requests, put Infura auth token here, or leave blank for default Kubo RPC | string | N | blank |
IPFS_BASIC_AUTH_USER | If required for read requests, put Infura Project ID here, or leave blank for default Kubo RPC | string | N | blank |
IPFS_ENDPOINT | URL to IPFS endpoint | URL | Y | |
IPFS_GATEWAY_URL | IPFS gateway URL '[CID]' is a token that will be replaced with an actual content ID | URL template | Y | |
QUEUE_HIGH_WATER | Max number of jobs allowed on the queue before blockchain scan will be paused to allow queue to drain | >= 100 | 1000 | |
REDIS_OPTIONS | Additional Redis options. See ioredis configuration | JSON string | Y (either this or REDIS_URL) | '{"commandTimeout":10000}' |
REDIS_URL | Connection URL for Redis | URL | Y (either this or REDIS_OPTIONS) | |
STARTING_BLOCK | Block number from which the service will start scanning the chain | > 0 | 1 | |
VERBOSE_LOGGING | Enable 'verbose' log level | boolean | N | false |
WEBHOOK_FAILURE_THRESHOLD | Number of failures allowed in the provider webhook before the service is marked down | > 0 | 3 | |
WEBHOOK_RETRY_INTERVAL_SECONDS | Number of seconds between provider webhook retry attempts when failing | > 0 | 10 | |
HTTP_RESPONSE_TIMEOUT_MS | Timeout in milliseconds to wait for a response as part of a request to an HTTP endpoint. Must be less than API_TIMEOUT_MS | > 0 and < API_TIMEOUT_MS | 3000 |
Best Practices
- Efficient Polling: Implement efficient polling mechanisms to minimize load on the service.
- Webhook Security: Secure webhooks by verifying the source of incoming requests.
- Rate Limiting: Apply rate limiting to prevent abuse and ensure fair usage of the service.