Skip to content

Live WebSocket Execution via Plugin Architecture #1299

Description

@AceTheCreator

Playground: Live WebSocket Execution via Plugin Architecture

The Playground is a powerful interactive surface for exploring AsyncAPI specs, but currently lacks the ability to execute or simulate operations. With the new plugin architecture now available in the React component, we can expose hooks that allow tooling to wire in live WebSocket connections for testing subscribe/publish/send/receive operations directly from the rendered spec.

WebSocket is proposed as the first protocol target (rather than HTTP/Webhook) because its persistent, bidirectional, event-driven nature maps much more naturally onto AsyncAPI's async operation model than a synchronous request/response protocol does.

Proposed Behavior

  • Users can open a live WebSocket connection directly from the rendered spec UI to test subscribe/publish/send/receive operations.
  • The Playground ships with a built-in default WebSocket plugin that supports:
    • Connecting to a server using the operation's WS/WSS bindings.
    • Sending messages for publish/send operations, constructed from the spec-defined schema.
    • Receiving and streaming incoming messages live for subscribe/receive operations.
    • Disconnecting cleanly, with automatic cleanup on unmount/navigation.

Acceptance Criteria

  • Playground registers a default WebSocket plugin for ws/wss protocol bindings
  • Users can open/close a connection manually, with a visible connection-status indicator (connecting / open / closed / error)
  • Outgoing messages (publish/send) can be composed and sent using the operation's schema, with basic client-side validation before send
  • Incoming messages (subscribe/receive) render as a live, scrollable message log, not a single static result
  • Reconnection behavior is defined (manual reconnect button at minimum; auto-reconnect with backoff as a stretch goal)
  • Errors (connection refused, dropped connection, invalid message against schema) surface gracefully with user-facing messages, distinct from a closed-but-healthy state
  • Connections are cleanly torn down when the user navigates away or unmounts the component, to avoid orphaned sockets
  • Existing Playground behavior is unaffected when no plugin is registered

Notes

  • Out of scope (for this issue): auto-reconnect with backoff, message history persistence across page reloads, and non-WS async protocols (MQTT, AMQP, Kafka), those can be tracked as follow-ups once the plugin pattern is validated here.
  • This is a stateful/streaming interaction model, distinct from the request/response model of HTTP plugins, expect the plugin architecture itself to need lifecycle hooks (onOpen, onMessage, onClose, onError) rather than a single call/response hook.

Metadata

Metadata

Assignees

Labels

micrograntParticipation in the Microgrant Program

Type

No type

Projects

Status
In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions