Polymarket.WebSocket (Polymarket v0.1.0)

Copy Markdown View Source

A WebSocket client for the Polymarket CLOB market feed.

Wraps Mint.WebSocket in a GenServer, handling the HTTP upgrade, periodic pings, and decoding of incoming text frames.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

t()

@type t() :: %Polymarket.WebSocket{
  caller: GenServer.from() | nil,
  closing?: boolean() | nil,
  conn: Mint.HTTP.t() | nil,
  last_pong: DateTime.t() | nil,
  request_ref: Mint.Types.request_ref() | nil,
  resp_headers: Mint.Types.headers() | nil,
  status: pos_integer() | nil,
  timer_ref: :timer.tref() | nil,
  websocket: Mint.WebSocket.t() | nil
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

send_message(pid, text)

@spec send_message(pid(), String.t()) :: :ok

start_link(opts)

@spec start_link(term()) :: {:ok, pid()} | {:error, term()}