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. |
Example
// Send a simple message through the WebSocket connection
codebolt.chat.sendMessage("Hi!", null);
// Send a message with additional payload data
codebolt.chat.sendMessage("Process complete", {
status: "success",
items: 5
});
Explanation
The codebolt.chat.sendMessage function sends a message through the WebSocket connection, optionally with additional payload data. This function enables real-time communication by allowing the script to send text messages and structured data to the Codebolt chat.