public class WebSocketMessage extends Object
See static factory methods in WebSocketSession for creating messages
with the DataBufferFactory for the session.
| Modifier and Type | Class and Description |
|---|---|
static class |
WebSocketMessage.Type
WebSocket message types.
|
| Constructor and Description |
|---|
WebSocketMessage(WebSocketMessage.Type type,
DataBuffer payload)
Constructor for a WebSocketMessage.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
DataBuffer |
getPayload()
Return the message payload.
|
String |
getPayloadAsText()
Return the message payload as UTF-8 text.
|
WebSocketMessage.Type |
getType()
Return the message type (text, binary, etc).
|
int |
hashCode() |
void |
release()
Release the payload
DataBuffer which is useful on runtimes
(e.g. |
WebSocketMessage |
retain()
Retain the data buffer for the message payload, which is useful on
runtimes (e.g.
|
public WebSocketMessage(WebSocketMessage.Type type, DataBuffer payload)
See static factory methods in WebSocketSession or alternatively
use WebSocketSession.bufferFactory() to create the payload and
then invoke this constructor.
public WebSocketMessage.Type getType()
public DataBuffer getPayload()
public String getPayloadAsText()
public WebSocketMessage retain()
DataBuffer payload = message.getPayload(); DataBufferUtils.retain(payload);
DataBufferUtils.retain(DataBuffer)public void release()
DataBuffer which is useful on runtimes
(e.g. Netty) with pooled buffers such as Netty. A shortcut for:
DataBuffer payload = message.getPayload(); DataBufferUtils.release(payload);
DataBufferUtils.release(DataBuffer)