publishText

Bun

Symbol

ServerWebSocket.publishText

publishText(topic: string, data: string, compress?: boolean): number

Sends a text message to subscribers of the topic.

@param topic

The topic name.

@param data

The data to send.

@param compress

Should the data be compressed? If the client does not support compression, this is ignored.

ws.publish("chat", "Hello!");
ws.publish("chat", "Compress this.", true);