sendRequestData method

void sendRequestData(
  1. String requestData
)

Sends a message to the WebSocket server.

requestData: The message to send (as a string)

If the WebSocket is not initialized, this method does nothing.

Implementation

void sendRequestData(String requestData) {
  if (_channel == null) {
    debugPrint("⚠️ WebSocket not initialized. Call initWebSocket() first.");
    return;
  }
  _channel?.sink.add(requestData); // Send the message
  debugPrint("⚠️ WebSocket sendRequestData :: $requestData");
}