code: private void parseTextMessage(String message) {
          JSONObject data;
          try {
              data = new JSONObject(message);
              if(!data.has("type")){
                  return;
              }
  
              String type = data.getString("type");
              if(type.equals("order")) {
                  if(orderUpdateListener != null) {
                      orderUpdateListener.onOrderUpdate(getOrder(data));
                  }
              }
  
          }catch (JSONException e) {
              e.printStackTrace();
          }
      }
docs: Parses incoming text message.