See Endpoint for a usage example.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | MessageHandler.Partial<
The type of the object that represent pieces of the incoming message that this MessageHandler will consume. T>This kind of handler is notified by the implementation as it becomes ready to deliver parts of a whole message. |
| public static interface | MessageHandler.Whole<
The type of the message object that this MessageHandler will consume. T>This kind of handler is notified by the container on arrival of a complete message. |
For handling parts of text messages, the type T is java.lang.String
For handling parts of binary messages, the allowable types for T are
java.nio.ByteBuffer Developers should not continue to reference message objects of type java.nio.ByteBuffer
after the completion of the onMessage() call, since they
may be recycled by the implementation.
Note
Implementations may choose their own schemes for delivering large messages in smaller parts through this API. These schemes may or may not bear a relationship to the underlying websocket dataframes in which the message is received off the wire.
| Modifier and Type | Method and Description |
|---|---|
| public void | onMessage(T
the partial message data. partialMessage, boolean flag to indicate if this partialMessage is the last of the whole message being delivered. last)Called when the next part of a message has been fully received. |
| onMessage | back to summary |
|---|---|
| public void onMessage(T partialMessage, boolean last) Called when the next part of a message has been fully received.
| |
For handling incoming text messages, the allowed types for T are
java.lang.Stringjava.io.Reader Decoder.Text or
Decoder.TextStream configuredFor handling incoming binary messages, the allowed types for T are
java.nio.ByteBuffer java.io.InputStream Decoder.Binary or
Decoder.BinaryStream configured
For handling incoming pong messages, the type of T is PongMessage
Developers should not continue to reference message objects of type java.io.Reader, java.nio.ByteBuffer
or java.io.InputStream after the completion of the onMessage() call, since they
may be recycled by the implementation.
| Modifier and Type | Method and Description |
|---|---|
| public void |
| onMessage | back to summary |
|---|---|
| public void onMessage(T message) Called when the message has been fully received.
| |