WebSockets
Access a direct feed of your tips with WebSockets.
Overview
WebSockets give creators a direct feed of the tips that are left on their pages. Once a tip is processed, a simple payload is pushed to your WebSocket connection so you can handle it in real-time.
Setup
1. Get an API key
You can get an API key under API Keys on your dashboard.
We recommend creating a new API key for each integration or service you use. This way, you can easily revoke access to a specific service without affecting others.
2. Connect to a feed
You can connect to a real-time feed with the API key above using one of the following URLs:
Firehose
The firehose feed sends all tips for all pages you own.
Page Activity Feed
The activity feed sends all tips for a specific page you own or have access to.
3. Keep your connection alive
With WebSockets, events are only sent/received when a connection is open. We only send events once to all open WebSocket connections after the tip is received.
To ensure you receive the events, there are several ways to make sure your connection stays alive:
-
Implement retry and reconnect mechanisms in your client.
-
Send a simple
ping
message every 60 seconds to keep the connection alive. The server should respond withpong
.
Events
campaigntip.notify
Sent when a new tip is received for a page you own or when a tip is replayed from the activity feed.
Testing
You can test receiving events by sending an echo message to an open WebSocket connection. The server will respond by sending the payload of the message back.
Below is an example of an echo message that can be sent to test receiving a campaigntip.notify
event.