Class MessageSerializer
java.lang.Object
com.tccc.kos.commons.web.websocket.router.msg.MessageSerializer
Convert a Message to text.
- Version:
- 2022-07-12
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiontoInbound
(OutboundMessage msg) Convert an outbound message to an inbound message that can be routed.void
toRaw
(InboundMessage msg) Convert a Message back to raw representation.toString
(RoutedMessage msg) Convert a Message to a string representation suitable for sending over websocket.
-
Constructor Details
-
MessageSerializer
public MessageSerializer()
-
-
Method Details
-
toInbound
Convert an outbound message to an inbound message that can be routed.- Parameters:
msg
- the message to convert
-
toString
Convert a Message to a string representation suitable for sending over websocket.- Parameters:
msg
- the message to convert
-
toRaw
Convert a Message back to raw representation. This is similar to toString(), except that instead of returning the serialized message it's stored back in the rawMsg property of the message so that toString() will simply return the raw data. This is useful if a message may be passed to toString() multiple times as once in raw form it just returns the raw string. If the message is already in raw form, this does nothing.
-