Annotation Interface WebSocket.OnMessage

Enclosing class:
WebSocket

@Target(METHOD) @Retention(CLASS) @Documented @Inherited @Singleton public static @interface WebSocket.OnMessage
A message listener method. There can be maximally two methods on a service with this annotation, and they must use different message type (i.e. one method max for binary, and one method max for string messages).

The following parameters are supported for any kind of message (binary and text):

  • boolean - without any qualifier, determining whether the message is the last one (optional, if not specified, message is always delivered in full); this parameter must be the LAST parameter of the method.
Binary messages can have the following parameters type (MUST have one of these): Text messages can have the following parameter type (MUST have one of these):
  • String
  • Reader - this method will be invoked on a separate virtual thread
  • non-boolean primitive type