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

# publish

> publish method for the PubSub.Client class.

### publish

* **publish**(`params`): `Promise<void>`

Publish a message into the specified channel.

#### Parameters

**`params`** `object` — required

Configuration object for publishing a message

---

**`params.channel`** `string` — required

Channel in which to send the message.

---

**`params.content`** `any` — required

The message to send. This can be any JSON-serializable object.

---

**`params.meta`** `Record<any, any toc={true}>`

Metadata associated with the message. There are no requirements on the content of metadata.

---

#### Returns

`Promise<void>`

#### Examples

Publishing a message as a string:

```js
await pubSub.publish({
  channel: "my-channel",
  content: "Hello, world."
});
```

Publishing a message as an object:

```js
await pubSub.publish({
  channel: "my-channel",
  content: {
    field_one: "value_one",
    field_two: "value_two"
  },
});
```