EventSource API · HTTP/1.1 · Auto-Reconnect

SSE Mock Server

Test real-time applications without backend infrastructure. Simulate server-sent event streams, custom event types, and live data feeds. Works offline, instant setup.

Full SSE Protocol Support

Everything you need to mock server-sent events for development and testing.

Event Stream Simulation

Simulate continuous server-sent event streams with configurable data patterns. Test real-time data flows without backend infrastructure.

Custom Event Types

Define custom event types beyond the default message. Route events by type for notifications, updates, alerts, and more.

Retry/Reconnection Handling

Configure retry intervals and test client reconnection logic. Simulate connection drops and recovery scenarios.

Event ID Tracking

Include event IDs for resumable streams. Clients can reconnect with Last-Event-ID to resume from where they left off.

Multi-Client Broadcasting

Broadcast events to multiple connected clients simultaneously. Test fan-out scenarios and connection scaling.

Configurable Event Intervals

Set custom intervals between events. Simulate burst traffic, steady streams, or variable timing patterns.

Simple Configuration

Define event streams, event types, and timing in a clean YAML format. Use template variables for dynamic data and weighted events for realistic scenarios.

  • Multiple streams: Define different endpoints for different data types
  • Custom event types: Send typed events clients can filter on
  • Event weighting: Control probability of different event types
  • Template helpers: Random values, timestamps, UUIDs
sse-mock.yaml
# mockd.yaml - SSE Mock Configuration
# SSE is a sub-type of HTTP in mockd
mocks:
  - id: dashboard-events
    type: http
    http:
      matcher:
        method: GET
        path: /events/dashboard
      sse:
        events:
          - type: metrics
            data: |
              {"cpu": 45, "memory": 62,
               "requests": 1250,
               "timestamp": "{{now}}"}
          - type: alert
            data: |
              {"level": "warning",
               "message": "High CPU usage",
               "timestamp": "{{now}}"}
        timing:
          fixedDelay: 1000
        lifecycle:
          keepaliveInterval: 15000

  - id: notifications
    type: http
    http:
      matcher:
        method: GET
        path: /events/notifications
      sse:
        events:
          - type: notification
            id: "{{uuid}}"
            data: |
              {"title": "New message",
               "body": "You have a new notification",
               "read": false,
               "createdAt": "{{now}}"}
        timing:
          fixedDelay: 5000
        resume:
          enabled: true
          bufferSize: 100

  - id: price-ticker
    type: http
    http:
      matcher:
        method: GET
        path: /events/ticker
      sse:
        events:
          - type: price
            data: |
              {"symbol": "AAPL",
               "price": 185.50,
               "timestamp": "{{now}}"}
        timing:
          fixedDelay: 500

Built for Real-Time Applications

From live dashboards to notification systems. Mockd handles your SSE testing needs.

Real-time Dashboards

Develop analytics dashboards with live-updating metrics, charts, and KPIs without backend dependencies.

Live Notifications

Build notification systems with instant push updates. Test toast messages, alerts, and user notifications.

Stock Tickers / Live Feeds

Simulate financial data streams, sports scores, or any live data feed requiring continuous updates.

Progress Updates

Mock long-running task progress. Test file uploads, batch processing, and background job status updates.

Why SSE vs Long Polling?

Server-Sent Events provide efficient unidirectional streaming. Mockd makes it easy to develop and test SSE-based features.

FeatureLong PollingMockd SSE
Connection control
Constant requests, wasted bandwidth
Single persistent connection
Latency
Delayed updates between polls
Instant event delivery
Server load
High request overhead
Minimal server resources
Development testing
Requires full backend
Mock events instantly
Reconnection
Manual implementation
Built-in Last-Event-ID support
Offline mode
Requires internet
Works completely offline

Start Mocking SSE in Minutes

Single Go binary. No dependencies. Connect your EventSource clients and start testing.

# Start the mock server
mockd init && mockd up