View Source ExOSC.Client (ex_osc v0.1.0)

A module for sending and receiving messages to/from an OSC server.

Starting a client will create a UDP socket on an arbitrary (system-assigned) port and then wait for messages to be sent or received. No initial negotiation is performed.

The client will act as a GenStage producer. To receive responses to your requests, you should create a GenStage consumer (or consumer-producer) and subscribe it to the PID returned by start_link/1. Each event will be a decoded OSC.Message structure.

Due to the stateless nature of the OSC protocol, it is up to the user of this library to ensure there is actually an OSC server at the target IP and port. Failure to do so will not cause any errors on startup, nor prevent sending messages, but will simply result in no actions being performed and no replies being received.

Link to this section Summary

Types

Option values used by start_link/1

Options used by start_link/1

Functions

Encodes and sends an OSC.Message to the target.

Starts a client that will send and receive OSC messages to/from a target IP and port.

Link to this section Types

@type option() ::
  {:ip, :inet.ip_address()} | {:port, :inet.port_number()} | GenServer.option()

Option values used by start_link/1

@type options() :: [option()]

Options used by start_link/1

Link to this section Functions

@spec send_message(pid(), %OSC.Message{args: term(), path: term()}) :: :ok

Encodes and sends an OSC.Message to the target.

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

Starts a client that will send and receive OSC messages to/from a target IP and port.

options

Options

  • :ip (required) - target IP in tuple form
  • :port (required) - target UDP port

This function also accepts all the options accepted by GenServer.start_link/3.

return-values

Return values

Same as GenServer.start_link/3.