For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuidesClick-to-Call
ReferenceGuidesClick-to-Call
  • Core
    • Overview
  • SignalWire Client
    • Overview
    • Notifications
    • Client
    • Utility functions
  • Video
    • Overview
    • LocalOverlay
    • RoomSession
    • RoomSessionDevice
    • RoomSessionPlayback
    • RoomSessionRecording
    • RoomSessionScreenShare
    • RoomSessionStream
    • RoomDevice
    • RoomScreenShare
  • Chat
    • Overview
    • Client
    • ChatMember
    • ChatMemberEntity
    • ChatMessage
    • ChatMessageEntity
  • PubSub
    • Overview
    • Client
      • Events
        • disconnect
        • getAllowedChannels
        • off
        • on
        • once
        • publish
        • removeAllListeners
        • subscribe
        • unsubscribe
        • updateToken
    • PubSubMessage
  • WebRTC
    • Overview
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • publish
PubSubClientMethods

publish

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

removeAllListeners

Next
Built with

publish

  • publish(params): Promise<void>

Publish a message into the specified channel.

Parameters

params
objectRequired

Configuration object for publishing a message

params.channel
stringRequired

Channel in which to send the message.

params.content
anyRequired

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:

1await pubSub.publish({
2 channel: "my-channel",
3 content: "Hello, world."
4});

Publishing a message as an object:

1await pubSub.publish({
2 channel: "my-channel",
3 content: {
4 field_one: "value_one",
5 field_two: "value_two"
6 },
7});