public class WebSocketMessage
extends java.lang.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(java.lang.Object other) |
DataBuffer |
getPayload()
Return the message payload.
|
java.lang.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 java.lang.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)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object