code: @OnMessage
      public void onMessage(String partialMessage, boolean last)
              throws MessageTooBigException {
          if (partialMessage.length() > maxMessageLength - messageBuffer.length()) {
              throw new MessageTooBigException(maxMessageLength);
          }
  
          if (last) {
              String message;
              if (messageBuffer.length() == 0) {
                  message = partialMessage;
              } else {
                  messageBuffer.append(partialMessage);
                  message = messageBuffer.toString();
  
                  // Reset the size to the defaultBufferSize and empty the buffer
                  messageBuffer.setLength(defaultBufferSize);
                  messageBuffer.trimToSize();
                  messageBuffer.setLength(0);
              }
  
              // Notify all registered listeners
              if (!message.equals("server received message")) {
                  // Salt API adds a "data: " prefix that we need to ignore
                  Event event = JsonParser.EVENTS.parse(message.substring(6));
                  notifyListeners(event);
              }
          } else {
              messageBuffer.append(partialMessage);
          }
      }
docs: Notify listeners on each event received on the websocket and buffer partial messages.
  
  @param partialMessage partial message received on this websocket
  @param last indicate the last part of a message
  @throws MessageTooBigException in case the message is longer than maxMessageLength