sendMessage
codebolt.chat.sendMessage(message: string, payload: any): void
Sends a message through the WebSocket connection.
Parameters
Name | Type | Description |
---|---|---|
message | string | The message to be sent. |
payload | any | Additional 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'
});