---title: Task.Clientsidebar_label: Client---import MethodOff from ../../_common/_method_off.mdx;import MethodOn from ../../_common/_method_on.mdx;import MethodOnce from ../../_common/_method_once.mdx;import MethodRemoveAllListeners from ../../_common/_method_removealllisteners.mdx;A [Task](./index.mdx) client. On your server, use instances of this client to receive data emitted with [Task.send](./index.mdx#send).#### Examplejavascriptconst client = new Task.Client({ project: , token: , contexts: [office],});client.on(task.received, (payload) => { console.log(Task Received, payload); // Do something with the payload...});## Constructors### constructor• **new Client**(opts)#### Parameters| Name | Type | Description || :-------------- | :--------- | :----------------------------------------------------------------------------------- || opts | Object | - || opts.contexts | string[] | SignalWire contexts, e.g. [home, office]. || opts.project | string | SignalWire project id, e.g. a10d8a9f-2166-4e82-56ff-118bc3a4840f. || opts.token | string | SignalWire project token, e.g. PT9e5660c101cd140a1c93a0197640a369cf5f16975a0079c9. |#### Examplejsconst client = new Task.Client({ project: , token: , contexts: [office],});## Methods### disconnect▸ **disconnect**(): voidDisconnects this client. The client will stop receiving events and you will need to create a new instance if you want to use it again.#### Returnsvoid#### Examplejsclient.disconnect();---### off---### on---### once---### removeAllListeners## Events### task.received• **task.received**(payload)Emitted whenever a task is received. Your event handler receives the payload. Example:javascriptconst client = new Task.Client(...)client.on(task.received, (payload) => { console.log(Task Received, payload) // Do something with the payload...})#### Parameters| Name | Type | Description || :-------- | :----------------------------- | :------------------- || payload | Record | The message payload. |