APITube Help Center

SSE vs WebSocket vs Webhooks: Which to Choose

Choose how new articles reach your app

Erick Horn

Written by Erick Horn

June 27, 2026

Updated October 16, 2026

SSE vs WebSocket vs webhooks: which to choose

Use a webhook to receive new articles at your server’s URL. Use SSE for a one-way stream with automatic reconnection. Use WebSocket if your app already uses sockets or needs to send keep-alive messages.

All three send article objects and charge one credit per delivered article. Connections, heartbeats and pings are free.

How do the three real-time methods compare?

MethodWho holds the connectionReconnectionCredit pool
WebhookAPITube POSTs to your URL — no socket on your sideAutomatic retries; 3 consecutive failures disable itSeparate webhook pool
SSEYour client holds GET /v1/news/stream openAutomatic, via the Last-Event-Id headerSeparate streaming pool
WebSocketYour client holds wss://…/v1/news/ws openManual — reconnect with new query paramsSeparate WebSocket pool

All three let you filter by language, category, source, sentiment and entities. A new subscription sends new matches, without a historical backlog. To fetch older articles, use /v1/news/everything.

When should I use a webhook?

Choose a webhook for server alerts. APITube sends signed JSON to your URL, so your app does not need an open connection. New matches are checked about every 10 seconds, with up to 100 articles per delivery.

Verify the X-Webhook-Signature header with your signing secret, and return 2xx promptly. Failed deliveries are retried. Three consecutive failed deliveries disable the webhook until you reactivate it.

Create webhooks in the dashboard. The API can list, read, update or delete existing ones. See what webhooks are and how they work.

When should I use SSE?

Choose Server-Sent Events for a client that stays connected and receives articles. Open /v1/news/stream. It checks for matches about every 30 seconds and sends up to 50 articles per cycle, with a heartbeat about every 30 seconds.

Each event includes an ID. Reconnect with that ID in Last-Event-Id to resume; the browser’s EventSource does this automatically. Connections last up to six hours. See how to stream news with SSE.

When should I use WebSocket?

Choose WebSocket when your client already uses wss or needs ping/pong messages. Connect to wss://api.apitube.io/v1/news/ws. Matches are checked about every 10 seconds, with up to 50 articles per cycle, a 30-second heartbeat and a six-hour connection limit.

WebSocket has no Last-Event-Id resume. Reconnect with your filters to start from the latest matches. A missing or invalid key closes the socket with code 1008. See how to stream news over WebSocket.

How does billing differ between them?

Each method has a separate quota: webhook, streaming or WebSocket credits. After that quota runs out, delivery can use pay-as-you-go balance if enabled and within your spending limit.

SSE rejects a connection with 402 ER0176 when no funds are available. WebSocket reports ER0404. Webhooks charge for articles in successful deliveries; failed attempts are free.

SSE and WebSocket allow 1 connection on Free, 2 on Starter, 2 on Basic, 10 on Professional and 50 on Corporate. Webhooks have their own plan limits rather than open-connection limits.

What if I only need occasional or historical articles?

Call /v1/news/everything when you need a search or a scheduled update. A search uses one request when it returns articles; an empty result is free. Each page can contain up to 250 articles on Professional and Corporate, 200 on Basic, 50 on Starter or 10 on Free.

Use the official endpoints reference to check available routes.

Common Questions

Which method is easiest to start with?

SSE is quick to try with cURL or a browser’s EventSource. Webhooks need a public endpoint that returns 2xx. WebSocket needs a client that handles connection and reconnection.

Can I use more than one method at the same time?

Yes. For example, use SSE for a dashboard and a webhook for server alerts. Each uses its own quota. The same article received through both methods is charged in each.

Do all three support the same filters?

They share search filters such as language, category, source, sentiment and entities. Add them to the stream URL or save them in the webhook builder. Streams also support fl to select fields; webhook setup excludes request options such as pagination, sorting and field selection.

Do test keys work with every method?

Yes. Test keys return preview content without using your quota. Check delivery, message parsing and reconnection before switching to a live key.


Related Articles