Getting Started

ZephyrPush is a real-time messaging service built on Cloudflare Workers that allows you to publish messages to channels and subscribe to them via WebSocket connections. It's perfect for real-time notifications, live chat, and event-driven applications.

What You'll Need

  • • An API key (get one from your dashboard)
  • • Basic knowledge of HTTP/WebSocket APIs
  • • Any programming language that can make HTTP requests

Quick Start Steps

  1. 1. Sign up for a free account
  2. 2. Generate your API key
  3. 3. Choose a channel name (channels are created automatically)
  4. 4. Start publishing and subscribing!

Authentication

All API requests require authentication using your API key. You can generate API keys from your dashboard after signing up.

Keep Your API Key Secure

Your API key provides access to your messaging channels. Never share it publicly or commit it to version control.

Channels

Channels are named endpoints for message routing. When you publish a message to a channel, all subscribers to that channel receive the message in real-time.

Dynamic Channel Creation

Channels are created automatically when you first publish a message to them. You don't need to create channels in advance - simply start publishing and subscribing!

Channel Naming Rules

  • • Channel names are case-sensitive
  • • Only letters, numbers, hyphens (-), and underscores (_) are allowed
  • • Maximum length: 255 characters
  • • Examples: my-channel, notifications_2024

API Reference

POST /auth

Get an authentication token for WebSocket connections.

Request Body

{
  "channel": "your-channel-name",
  "api_key": "your-api-key"
}

Response

Success (200)
{
  "token": "jwt-authentication-token"
}
Error Responses
400 Bad Request Invalid channel name
{
  "error": "Channel name contains invalid characters"
}
401 Unauthorized Invalid API key
Invalid API key
POST /publish

Publish a message to a channel.

Request Body

{
  "channel": "your-channel-name",
  "data": {
    "message": "Hello, world!",
    "timestamp": 1234567890
  },
  "api_key": "your-api-key",
  "event": "message"
}

Parameters

  • channel (required): The channel name to publish to
  • data (required): The message payload (any JSON object)
  • api_key (required): Your API key
  • event (optional): Event type ("message", "notification", "alert", "update")
Message Size Limits
  • Free Tier: 1KB maximum per message
  • Pro Tier: 10KB maximum per message
  • Enterprise Tier: 10KB maximum per message

Upgrade to Pro for 10x larger message payloads!

Response

Success (200)
{
  "success": true,
  "message": "Message published successfully"
}
Error Responses
400 Bad Request Missing required fields
{
  "error": "Missing required field: channel"
}
401 Unauthorized Invalid API key
{
  "error": "Invalid API key"
}
403 Forbidden Publishing to unowned channel
Access denied: You do not own this channel
400 Bad Request Invalid channel name
{
  "error": "Channel name contains invalid characters"
}
429 Too Many Requests Monthly message limit exceeded
Monthly message limit exceeded. Please upgrade your plan.
413 Payload Too Large Message size limit exceeded
{
  "error": "Message size limit exceeded. Maximum allowed: 1KB, your message: 1.5KB. Upgrade to Pro for 10x larger messages."
}
WebSocket /subscribe

Connect to a WebSocket for real-time message subscription.

Connection URL

wss://api.zephyrpush.com/subscribe?token=your-jwt-token

Connection Status

Successful Connection

WebSocket connection opens successfully and begins receiving messages.

Connection Errors
400 Bad Request Missing channel parameter
Missing channel
400 Bad Request Invalid channel name
{
  "error": "Channel name contains invalid characters"
}
401 Unauthorized Missing or invalid JWT token
Missing token
403 Forbidden No permission to access the channel
Access denied: You do not own this channel
404 Not Found Channel doesn't exist
Channel not found
429 Too Many Requests Connection limit exceeded
{
  "error": "Connection limit exceeded",
  "limit": 500,
  "current": 500,
  "message": "Upgrade your subscription for higher limits"
}

Message Format

{
  "event": "message",
  "data": {
    "message": "Hello, world!",
    "timestamp": 1234567890
  },
  "timestamp": 1234567890,
  "channel": "your-channel-name"
}
GET /analytics

Get analytics data for your channels.

Query Parameters

  • channel (optional): Filter by specific channel
  • period (optional): Time period ("day", "week", "month")

Response

Success (200)
{
  "totalMessages": 1250,
  "monthlyMessages": 0,
  "activeChannels": 5,
  "connectedUsers": 0,
  "messageVolume": [0],
  "timeSeries": []
}
Pro Features

Pro subscribers get additional advanced analytics including:

  • Detailed channel-specific metrics
  • Response time analytics
  • Error rate tracking
  • Geographic distribution data

Advanced analytics features are available for Pro and Enterprise subscribers.

Rate Limiting

ZephyrPush implements user-based rate limiting to ensure fair usage and protect the service. Rate limits vary by subscription tier.

Response Headers

Every API response includes rate limit headers to help you track your usage:

Header Description
X-RateLimit-Limit Maximum requests allowed in the current window
X-RateLimit-Remaining Number of requests remaining in the current window
X-RateLimit-Reset Unix timestamp when the rate limit window resets
X-RateLimit-Policy Rate limit policy in format limit;w=window_seconds
Retry-After Seconds to wait before retrying (only included when rate limited)

Example Response Headers

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 115
X-RateLimit-Reset: 1732982460
X-RateLimit-Policy: 120;w=60

Rate Limits by Tier

All rate limits are per-minute windows. Higher tier subscriptions receive increased limits:

Endpoint Free Pro Enterprise
/publish 60/min 120/min 300/min
/subscribe 30/min 60/min 150/min
Polling endpoints 120/min 240/min 600/min
Authentication endpoints 5-10/min (IP-based, same for all tiers)

Rate Limit Exceeded Response

When you exceed the rate limit, you'll receive a 429 Too Many Requests response:

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 30
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1732982460

{
  "error": "Rate limit exceeded",
  "limit": 60,
  "remaining": 0,
  "resetAt": "2024-11-30T15:01:00.000Z",
  "retryAfter": 30
}

Handling Rate Limits

Best practices for handling rate limits in your application:

JavaScript Example

async function makeApiRequest(url, options) {
  const response = await fetch(url, options);
  
  // Check if rate limited
  if (response.status === 429) {
    const retryAfter = parseInt(response.headers.get('Retry-After') || '60');
    console.log(`Rate limited. Retrying in ${retryAfter} seconds...`);
    await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
    return makeApiRequest(url, options); // Retry
  }
  
  // Log remaining requests when low
  const remaining = response.headers.get('X-RateLimit-Remaining');
  if (remaining && parseInt(remaining) < 10) {
    console.warn(`Low rate limit: ${remaining} requests remaining`);
  }
  
  return response;
}

Tip: Always check the Retry-After header when rate limited, as it tells you exactly how long to wait before your next request.

Code Examples


							
						

Frequently Asked Questions

What is ZephyrPush?

ZephyrPush is a real-time messaging service built on Cloudflare Workers that allows you to publish messages to channels and subscribe to them via WebSocket connections. It's perfect for real-time notifications, live chat, and event-driven applications.

How do I get started?

1. Sign up for a free account
2. Generate an API key from your dashboard
3. Use the provided code examples to publish messages or subscribe to channels
4. Test your integration using the WebSocket connection
5. Monitor usage and performance from the Dashboard

What are the rate limits?

The free tier allows up to 100,000 messages per month. Each API key is rate-limited to prevent abuse. If you need higher limits, please contact support for enterprise options.

How do channels work?

Channels are named endpoints for message routing. When you publish a message to a channel, all subscribers to that channel receive the message in real-time. Channels are created automatically when you first publish to them - you don't need to create them in advance. Channel names are case-sensitive and can contain letters, numbers, hyphens, and underscores.

Is my data secure?

Yes! All connections use JWT authentication, and messages are transmitted over secure WebSocket connections (WSS). API keys are required for all operations and should be kept secret.

Can I use multiple channels?

Absolutely! You can publish to multiple channels simultaneously and subscribe to multiple channels from a single WebSocket connection. This is useful for broadcasting messages to different user groups or implementing complex notification systems.

What programming languages are supported?

ZephyrPush works with any language that can make HTTP requests and establish WebSocket connections. We provide code examples for JavaScript, Python, cURL, PHP, Go and Rust. The REST API is language-agnostic.

How do I monitor my usage?

The Dashboard provides real-time analytics including total messages, active channels, connected users, and monthly usage. You can view message volume over time and monitor system health.

What happens if I exceed the free tier?

Once you reach 100,000 messages in a month, publishing will be rate-limited. You'll still be able to receive messages, but new publishes may be delayed. Upgrade to a paid plan for higher limits.

How do I subscribe to multiple channels?

To subscribe to multiple channels, create separate WebSocket connections for each channel. Each connection requires its own authentication token.

JavaScript Example:

// Subscribe to multiple channels
async function subscribeToChannels(channels, apiKey) {
    const connections = {};

    for (const channel of channels) {
        // Get token for each channel
        const authResponse = await fetch('https://api.zephyrpush.com/auth', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ channel, api_key: apiKey })
        });
        const { token } = await authResponse.json();

        // Create WebSocket for each channel
        const ws = new WebSocket(`wss://api.zephyrpush.com/subscribe?token=${token}`);

        ws.onmessage = (event) => {
            const message = JSON.parse(event.data);
        };

        connections[channel] = ws;
    }

    return connections;
}

// Usage
const connections = await subscribeToChannels(['notifications', 'chat', 'updates'], 'your-api-key');

How do I get support?

For technical issues, check the WebSocket connection and review the code examples. For account or billing questions, contact our support team. Enterprise customers get priority support and dedicated account management.

Support & Contact

Technical Support

Need help with integration or troubleshooting? Our technical support team is here to help.

Email Support

We typically respond within 24 hours

Resources

Check out our comprehensive resources for detailed guides and API references.

Before Contacting Support

  • Check that your API key is correct and not expired
  • Verify your channel name follows the naming rules
  • Ensure you're using the correct WebSocket URL and protocol
  • Check the browser console for JavaScript errors