code: public void sendSync(BasicMessageWithExtraData<? extends BasicMessage> messageWithData) throws Exception {
          if (!isConnected()) {
              throw new IllegalStateException("WebSocket connection was closed. Cannot send any messages");
          }
  
          BasicMessage message = messageWithData.getBasicMessage();
          configurationAuthentication(message);
  
          if (messageWithData.getBinaryData() == null) {
              String messageString = ApiDeserializer.toHawkularFormat(message);
              @SuppressWarnings("resource")
              Buffer buffer = new Buffer().writeUtf8(messageString);
              RequestBody requestBody = RequestBody.create(WebSocket.TEXT, buffer.readByteArray());
              FeedCommProcessor.this.webSocket.sendMessage(requestBody);
          } else {
              BinaryData messageData = ApiDeserializer.toHawkularFormat(message, messageWithData.getBinaryData());
  
              RequestBody requestBody = new RequestBody() {
                  @Override
                  public MediaType contentType() {
                      return WebSocket.BINARY;
                  }
  
                  @Override
                  public void writeTo(BufferedSink bufferedSink) throws IOException {
                      emitToSink(messageData, bufferedSink);
                  }
              };
  
              FeedCommProcessor.this.webSocket.sendMessage(requestBody);
  
          }
      }
docs: Sends a message to the server synchronously. This will return only when the message has been sent.
  
  @param messageWithData the message to send
  @throws IOException if the message failed to be sent