Getting Started
Telpun offers a real-time pub/sub API over SSE (Server-Sent Events). It’s simple to use both on the frontend and backend.
Connect to Telpun
Client connect and subscribe to namespace to Telpun using a SUBSCRIBER_API_KEY key:
const telpun = new Telpun("SUBSCRIBER_API_KEY", ["namespace1", "namespace2"]);
telpun.connect()
Subscribing to Events (Frontend)
Listen to a topic from your frontend:
telpun.on("namespace1.action", (data) => {
console.log("Received:", data);
});
Each namespace acts as a pub/sub channel.
Publishing Events (Backend)
Send events from your backend via a simple HTTP POST:
POST /emit
Content-Type: application/json
{
"namespace": "namespace1",
"action": "action"
"data": {
"text": "Hello from server"
}
}
Delivery Quota
Each message delivered to one client counts as one delivery. For example, sending to 5 clients = 5 deliveries.
- Your quota resets on the 1st of each month (UTC)
- Quota is shared across all projects under your account
- Check your usage via the dashboard or upcoming API endpoint
Error Handling
If the event can't be delivered or quota is exceeded, Telpun will respond with HTTP error codes (e.g., 429 for quota exceeded).