> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# once

> once method for the PubSub.Client class.

### once

* **once**(`event`, `fn`)

Attaches an event handler to the specified event. The handler will fire only once.

#### Parameters

| Name    | Type     | Description                                                                                          |
| :------ | :------- | :--------------------------------------------------------------------------------------------------- |
| `event` | `string` | Name of the event. See the list of [events](/docs/browser-sdk/v3/js/reference/pubsub/client/events). |
| `fn`    | Function | An event handler.                                                                                    |