WebSocket client for Daytona's websocket endpoints (PTY sessions, interpreter execution).
A connection is a process; frames arrive as messages to its owner
(by default, the process that called connect/3):
{:ex_daytona_ws, pid, {:text, data}}/{:ex_daytona_ws, pid, {:binary, data}}{:ex_daytona_ws, pid, {:closed, reason}}— the connection ended; the process exits normally afterwards
Usually used through ExDaytona.Pty rather than directly.
Summary
Functions
Returns a specification to start this module under a supervisor.
Close the connection (sends a close frame and stops the process).
Open a websocket connection to url (an http(s):// or ws(s):// URL —
https is converted to wss) authenticated with api_key.
Send a binary frame.
Send a text frame.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec close(pid()) :: :ok
Close the connection (sends a close frame and stops the process).
@spec connect(String.t(), String.t(), keyword()) :: {:ok, pid()} | {:error, ExDaytona.Error.t()}
Open a websocket connection to url (an http(s):// or ws(s):// URL —
https is converted to wss) authenticated with api_key.
Options
:owner— the pid that receives frame messages (default: the caller):connect_timeout— milliseconds to wait for the upgrade (default15_000)
@spec send_binary(pid(), iodata()) :: :ok | {:error, ExDaytona.Error.t()}
Send a binary frame.
@spec send_text(pid(), iodata()) :: :ok | {:error, ExDaytona.Error.t()}
Send a text frame.