Package net.carcdr.yhocuspocus.protocol
Class IncomingMessage
java.lang.Object
net.carcdr.yhocuspocus.protocol.IncomingMessage
Represents an incoming message from a client.
Incoming messages are decoded from binary format using the protocol: [documentName: varString][messageType: varInt][...payload]
-
Constructor Summary
ConstructorsConstructorDescriptionIncomingMessage(String documentName, MessageType type, byte[] payload, byte[] rawData) Creates a new incoming message. -
Method Summary
Modifier and TypeMethodDescriptionGets the document name from the message.byte[]Gets the message payload.byte[]Gets the original raw message data.Gets the stateless message payload as a string.getToken()Gets the authentication token from AUTH messages.getType()Gets the message type.toString()
-
Constructor Details
-
IncomingMessage
Creates a new incoming message.- Parameters:
documentName- the document nametype- the message typepayload- the message payloadrawData- the original raw message data
-
-
Method Details
-
getDocumentName
Gets the document name from the message.- Returns:
- document name (never null)
-
getType
Gets the message type.- Returns:
- message type (never null)
-
getPayload
public byte[] getPayload()Gets the message payload.- Returns:
- payload bytes (never null, may be empty)
-
getRawData
public byte[] getRawData()Gets the original raw message data.- Returns:
- raw message bytes (never null)
-
getToken
Gets the authentication token from AUTH messages.For AUTH messages, the payload contains the token as a varString.
- Returns:
- authentication token, or null if not an AUTH message
-
getStatelessPayload
Gets the stateless message payload as a string.For STATELESS/BROADCAST_STATELESS messages, decodes the payload.
- Returns:
- stateless payload, or null if not a stateless message
-
toString
-