Client

Task.Client

Constructors

constructor

new Client(opts)

Parameters

NameTypeDescription
optsObject-
opts.contextsstring[]

SignalWire contexts, e.g. 'home', 'office'…

opts.projectstring

SignalWire project id, e.g. a10d8a9f-2166-4e82-56ff-118bc3a4840f

opts.tokenstring

SignalWire project token, e.g. PT9e5660c101cd140a1c93a0197640a369cf5f16975a0079c9

Methods

disconnect

disconnect(): void

Disconnects this client. The client will stop receiving events and you will need to create a new instance if you want to use it again.

Returns

void

Example

client.disconnect()

off

off<T>(event, fn?): EmitterContract<TaskClientApiEvents>

Type parameters

NameType
Textends "task.received"

Parameters

NameType
eventT
fn?(...args: ArgumentMap<TaskClientApiEvents>[Extract<T, "task.received">]) => void

Returns

EmitterContract<TaskClientApiEvents>


on

on<T>(event, fn): EmitterContract<TaskClientApiEvents>

Type parameters

NameType
Textends "task.received"

Parameters

NameType
eventT
fn(...args: ArgumentMap<TaskClientApiEvents>[Extract<T, "task.received">]) => void

Returns

EmitterContract<TaskClientApiEvents>


once

once<T>(event, fn): EmitterContract<TaskClientApiEvents>

Type parameters

NameType
Textends "task.received"

Parameters

NameType
eventT
fn(...args: ArgumentMap<TaskClientApiEvents>[Extract<T, "task.received">]) => void

Returns

EmitterContract<TaskClientApiEvents>


removeAllListeners

removeAllListeners<T>(event?): EmitterContract<TaskClientApiEvents>

Type parameters

NameType
Textends "task.received"

Parameters

NameType
event?T

Returns

EmitterContract<TaskClientApiEvents>