JSPM

@socketo/cli

0.0.0-alpha.11
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 815
  • Score
    100M100P100Q4251F
  • License UNLICENSED

Local Pusher-compatible WebSocket server for development

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@socketo/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @socketo/cli

    Local Pusher-compatible WebSocket server. Drop-in replacement for Pusher Channels during development — same protocol, zero config, no API key needed.

    Built on Miniflare and Cloudflare Durable Objects, using the WebSocket Standard API for persistent in-memory state.

    npx @socketo/cli start

    Server listens at ws://localhost:8787.

    Usage

    npx @socketo/cli start [options]
    
      -p, --port <port>            Port (default: 8787)
      --webhook-url <url>          Webhook URL for server-side callbacks
      --webhook-secret <secret>    HMAC secret for webhook signatures

    Client SDK

    // Client
    import PusherJS from 'pusher-js'
    
    const pusher = new Pusher('local', {
      wsHost: 'localhost',
      wsPort: 8787,
      forceTLS: false,
      enabledTransports: ['ws'],
      cluster: 'local',
    })

    Server SDK

    import Pusher from 'pusher'
    
    const server = new Pusher({
      appId: 'local',
      key: 'local',
      secret: 'local',
      host: 'localhost:8787',
      useTLS: false,
    })
    
    server.trigger('my-channel', 'my-event', { hello: 'world' })

    Supported

    WebSocket Protocol

    • pusher:connection_established handshake
    • Subscribe / unsubscribe (public, private, presence)
    • Client events (client-*)
    • Ping / pong

    Presence Channels

    • channel_data with user_id and user_info
    • pusher_internal:subscription_succeeded with member list
    • member_added / member_removed events

    REST API

    Method Path Description
    POST /apps/local/events Trigger events
    POST /apps/local/batch_events Trigger up to 10 events
    GET /apps/local/channels List channels
    GET /apps/local/channels/{name} Channel info
    GET /apps/local/channels/{name}/users Presence users
    POST /apps/local/users/{id}/terminate_connections Disconnect user

    Query params: ?filter_by_prefix= and ?info=user_count,subscription_count.

    Webhooks

    POST to your URL when channels are occupied/vacated, members join/leave, or client events fire. Payload matches Pusher's webhook format with X-Pusher-Key and X-Pusher-Signature headers.

    State

    Connection state survives indefinitely (no hibernation). Channels, members, and user data persist across requests.

    CORS

    All HTTP endpoints return Access-Control-Allow-Origin: *.

    Not Supported

    • Authentication (auth signatures, body_md5)
    • Encrypted channels (E2E)
    • Cache channels
    • TLS / WSS