Skip to main content

sendMessage

codebolt.chat.sendMessage(message: string, payload: any): void
Sends a message through the WebSocket connection.

Parameters

NameTypeDescription
messagestringThe message to be sent.
payloadanyAdditional data to send along with the message.

Examples

// Example 1: Send a simple text message
codebolt.chat.sendMessage("Hello, CodeBolt!");

// Example 3: Send a message with payload data
codebolt.chat.sendMessage("File processing complete", {
timestamp: new Date().toISOString(),
source: 'codeboltjs-script',
fileCount: 5,
status: 'success'
});

sendMessage