OffBroadwayWebSocket.Producer (off_broadway_websocket v1.2.2)

Copy Markdown View Source

A GenStage producer that streams data from a WebSocket connection.

Under the hood it relies on the gun library to establish and manage the connection. Incoming frames are buffered and dispatched based on the demand from Broadway consumers. Idle connections are supervised with ping/pong logic and automatic reconnection using a user supplied backoff strategy.

Summary

Functions

Starts the WebSocket producer under a GenStage supervisor.

Types

frame_handler_result()

@type frame_handler_result() ::
  {:emit, [term()], term()} | {:skip, term()} | {:error, term(), term()}

on_upgrade_result()

@type on_upgrade_result() :: {:ok, [outbound_frame()]} | {:error, term()}

outbound_frame()

@type outbound_frame() :: {:text | :binary, iodata()}

Functions

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts the WebSocket producer under a GenStage supervisor.