*** id: d25281fa-4ff4-4206-baff-c9a9a7c4bbe5 title: publish slug: /node/reference/pubsub/client/publish description: publish method for the Client class. max-toc-depth: 3 ---------------- ### publish * **publish**(`params`): `Promise` Publish a message into the specified channel. #### Parameters Object containing the parameters of the method. 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 import { SignalWire } from '@signalwire/realtime-api' const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" }) const pubSubClient = client.pubSub; await pubSubClient.publish({ channel: "my-channel", content: "Hello, world." }); ``` Publishing a message as an object: ```js import { SignalWire } from '@signalwire/realtime-api' const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" }) const pubSubClient = client.pubSub; await pubSubClient.publish({ channel: "my-channel", content: { field_one: "value_one", field_two: "value_two" } }); ```