ExDaytona.Transport.WebSocketClient behaviour (ex_daytona v0.3.0)

Copy Markdown View Source

Behaviour for websocket client transports.

Implementations deliver frames to the owner as {:ex_daytona_ws, pid, {:text | :binary, data}} messages and signal the end with {:ex_daytona_ws, pid, {:closed, reason}} — the message protocol ExDaytona.WebSocket established.

Summary

Callbacks

close(pid)

@callback close(pid()) :: :ok

connect(url, api_key, opts)

@callback connect(url :: String.t(), api_key :: String.t(), opts :: keyword()) ::
  {:ok, pid()} | {:error, ExDaytona.Error.t()}

send_binary(pid, iodata)

@callback send_binary(pid(), iodata()) :: :ok | {:error, ExDaytona.Error.t()}

send_text(pid, iodata)

@callback send_text(pid(), iodata()) :: :ok | {:error, ExDaytona.Error.t()}