Skip to main content

SignalWire.Relay.Client

SignalWire.Relay.Client is the basic connection to Relay, allowing you send commands to Relay and set up handlers for inbound events.

Constructor​

Constructs a client object to interact with Relay.

Parameters

ParameterTypeRequiredDescription
projectstringrequiredProject ID from your SignalWire Space
tokenstringrequiredToken from your SignalWire Space

Examples

Create a Client to interact with the Relay API.

Client client = new Client("my-project-id", "my-project-token");

Properties​

PropertyTypeDescription
CallingSignalWire.Relay.CallingAPIReturns a SignalWire.Relay.CallingAPI instance associated with the client.
MessagingSignalWire.Relay.MessagingAPIReturns a SignalWire.Relay.MessagingAPI instance associated with the client.

Methods​

Connect​

Activates the connection to the Relay API. The connection to Relay does not happen automatically so that you can setup handlers to events that might occur before the connection is successfully established.

Returns

void

Examples

// Make sure you have attached the listeners you need before connecting the client, or you might miss some events.
client.Connect()

Disconnect​

Disconnect the client from Relay.

Returns

void

Examples

client.Disconnect()

Events​

All available events you can attach a listener on.

PropertyDescription
OnReadyThe client has connected and may proceed with signalwire protocol setup.
OnDisconnectedThe client has disconnected.