skode/transport/udp

UDP transport for communicating with the Skred / Pulp audio engine on the BEAM.

Pulp’s mini-skred engine listens on UDP port 7000 by default (when built with SKRED_UDP=ON). This transport allows any Gleam, Elixir, Erlang, or LFE process on the BEAM to stream commands with zero C/NIF dependencies.

Types

pub type UdpSocket

Values

pub fn close(socket: UdpSocket) -> Nil

Close an open UDP socket.

pub const default_host: String
pub const default_port: Int
pub fn open() -> Result(UdpSocket, String)

Open an ephemeral client UDP socket.

pub fn open_port(port: Int) -> Result(UdpSocket, String)

Open a UDP socket bound to a specific local port.

pub fn send(
  socket: UdpSocket,
  data: String,
) -> Result(Nil, String)

Send raw string to the default Pulp host and port (127.0.0.1:7000).

pub fn send_chunk(
  socket: UdpSocket,
  host: String,
  port: Int,
  chunk: skode.Chunk,
) -> Result(Nil, String)

Send a single AST Chunk to host:port.

pub fn send_chunk_default(
  socket: UdpSocket,
  chunk: skode.Chunk,
) -> Result(Nil, String)

Send a single AST Chunk to the default Pulp host and port (127.0.0.1:7000).

pub fn send_ops(
  socket: UdpSocket,
  host: String,
  port: Int,
  ops: List(skode.Op),
) -> Result(Nil, String)

Send a list of AST Ops canonically formatted to host:port.

pub fn send_ops_default(
  socket: UdpSocket,
  ops: List(skode.Op),
) -> Result(Nil, String)

Send a list of AST Ops to the default Pulp host and port (127.0.0.1:7000).

pub fn send_program(
  socket: UdpSocket,
  host: String,
  port: Int,
  program: List(skode.Chunk),
) -> Result(Nil, String)

Send an entire AST program (List(Chunk)) to host:port.

pub fn send_program_default(
  socket: UdpSocket,
  program: List(skode.Chunk),
) -> Result(Nil, String)

Send an entire AST program (List(Chunk)) to the default Pulp host and port.

pub fn send_text(
  socket: UdpSocket,
  host: String,
  port: Int,
  data: String,
) -> Result(Nil, String)

Low-level send of raw string payload to host:port.

✨ Search Document