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
Parameter | Type | Required | Description |
---|---|---|---|
project | string | required | Project ID from your SignalWire Space |
token | string | required | Token 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
Property | Type | Description |
---|---|---|
Calling | SignalWire.Relay.CallingAPI | Returns a SignalWire.Relay.CallingAPI instance associated with the client. |
Messaging | SignalWire.Relay.MessagingAPI | Returns 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.
Property | Description |
---|---|
OnReady | The client has connected and may proceed with signalwire protocol setup. |
OnDisconnected | The client has disconnected. |