Plugin Real-time

Reverb — WebSocket broadcasting

Laravel Reverb–style channel subscriptions over WebSockets. Complements Transmit (SSE): use SSE for simple server → client push; use Reverb when clients subscribe to named channels and you may need bidirectional JSON control messages.

§ Features

  • GET WebSocket endpoint (default /reverb/ws, override with REVERB_PATH).
  • JSON text frames: subscribe, unsubscribe, ping.
  • reverb.Broadcast(ctx, channel, data) — with REDIS_URL, fan-out uses Redis Pub/Sub so every instance delivers to its local subscribers; without Redis, broadcasts are single-process only.
  • GET …/health next to the WS path (e.g. /reverb/health when WS is /reverb/ws).
  • Optional REVERB_ALLOWED_ORIGINS (comma-separated) for the WebSocket Origin check.

§ Installation

$ nimbus plugin:install reverb

Registers app.Use(reverb.New(nil)) and scaffolds config/reverb.go / loadReverb().

§ Server-side broadcast

import (
    "context"
    "github.com/CodeSyncr/nimbus/plugins/reverb"
)

func notifyOrderShipped(orderID string) {
    _ = reverb.Broadcast(context.Background(), "orders."+orderID, map[string]any{
        "event": "shipped",
    })
}

§ Browser protocol

Connect to wss://your-host/reverb/ws (or your REVERB_PATH). After connected, send:

{"action":"subscribe","channel":"orders.42"}
{"action":"unsubscribe","channel":"orders.42"}
{"action":"ping"}

Server events include subscribed, message (payload in data), and pong.

§ Environment

Variable Description
REDIS_URLMulti-instance fan-out (default Pub/Sub channel nimbus:reverb:fanout)
REVERB_PATHWebSocket route (default /reverb/ws)
REVERB_ALLOWED_ORIGINSAllowed Origin hosts, comma-separated
REVERB_REDIS_CHANNELOverride Redis channel name

Core vs plugin: Low-level hubs live in github.com/CodeSyncr/nimbus/websocket. Reverb adds channel routing, JSON protocol, and optional Redis — see WebSockets.