*** id: 0b31547c-c3f8-4c6f-8458-7aafab91fcef title: publish slug: /js/reference/pubsub/client/publish description: publish method for the PubSub.Client class. max-toc-depth: 3 ---------------- ### publish * **publish**(`params`): `Promise` Publish a message into the specified channel. #### Parameters Configuration object for publishing a message Channel in which to send the message. The message to send. This can be any JSON-serializable object. Metadata associated with the message. There are no requirements on the content of metadata. #### Returns `Promise` #### 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" }, }); ```