onTextMessage method

void onTextMessage(
  1. String text
)

Handles the text message received from the WebSocket server

Implementation

void onTextMessage(String text) async {
  final json = jsonDecode(text);
  if (json.containsKey(JsonConstants.result)) {
    handleServerResponse(json);
  } else if (json.containsKey(JsonConstants.error)) {
    handleServerError(json);
  } else {
    handleServerEvent(json);
  }
}