Skip to content

feat(go-api): WebSocket endpoint with Redis Streams fan-out #15

@Depo-dev

Description

@Depo-dev

Summary

Real-time event delivery to SDK clients requires a WebSocket endpoint backed by a Redis Streams consumer.

Acceptance Criteria

  • GET /ws — upgrades to WebSocket; accepts contractId and optional topic0 query params
  • Background goroutine per connection: XREAD BLOCK on trident:events stream, filter by contractId/topic0, write JSON to the WebSocket
  • Hub manages all active connections; cleans up on disconnect
  • Ping/pong keepalive (60s timeout)
  • Tests for the hub: connect, receive event, disconnect lifecycle

Files

services/api/ws/hub.go (new), services/api/ws/client.go (new)

Dependencies

Requires github.com/gorilla/websocket or stdlib golang.org/x/net/websocket (decide and document).

Metadata

Metadata

Assignees

No one assigned

    Labels

    goGo service workphase-1MVP phase 1 scope

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions