Class GenericWebSocketMessage
- All Implemented Interfaces:
WebSocketMessage
Generic WebSocketMessage implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classGenericWebSocketMessage.Factoryimplementation.Nested classes/interfaces inherited from interface io.inverno.mod.http.base.ws.WebSocketMessage
WebSocketMessage.Factory, WebSocketMessage.Kind -
Constructor Summary
ConstructorsConstructorDescriptionGenericWebSocketMessage(WebSocketMessage.Kind kind, org.reactivestreams.Publisher<WebSocketFrame> frames) Creates a generic WebSocket message. -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<io.netty.buffer.ByteBuf> binary()Returns the message payload binary data stream.org.reactivestreams.Publisher<WebSocketFrame> frames()Returns the frames that composes the message.getKind()Returns the WebSocket message type.reactor.core.publisher.Mono<io.netty.buffer.ByteBuf> Returns the message payload binary data.reactor.core.publisher.Mono<String> Returns the message payload text data stream.org.reactivestreams.Publisher<String> text()Returns the message payload text data stream.
-
Constructor Details
-
GenericWebSocketMessage
public GenericWebSocketMessage(WebSocketMessage.Kind kind, org.reactivestreams.Publisher<WebSocketFrame> frames) Creates a generic WebSocket message.
- Parameters:
kind- the message typeframes- the frames that composes the message
-
-
Method Details
-
getKind
Description copied from interface:WebSocketMessageReturns the WebSocket message type.
- Specified by:
getKindin interfaceWebSocketMessage- Returns:
- a WebSocket message type
-
frames
Description copied from interface:WebSocketMessageReturns the frames that composes the message.
Note that the returned publisher is exclusive: it is only possible to subscribe to one of the publisher returned by
WebSocketMessage.frames(),WebSocketMessage.binary(),WebSocketMessage.reducedBinary(),WebSocketMessage.text()orWebSocketMessage.reducedText().- Specified by:
framesin interfaceWebSocketMessage- Returns:
- a WebSocker frames publisher
-
binary
public org.reactivestreams.Publisher<io.netty.buffer.ByteBuf> binary()Description copied from interface:WebSocketMessageReturns the message payload binary data stream.
Note that the returned publisher is exclusive: it is only possible to subscribe to one of the publisher returned by
WebSocketMessage.frames(),WebSocketMessage.binary(),WebSocketMessage.reducedBinary(),WebSocketMessage.text()orWebSocketMessage.reducedText().- Specified by:
binaryin interfaceWebSocketMessage- Returns:
- a data publisher
-
reducedBinary
public reactor.core.publisher.Mono<io.netty.buffer.ByteBuf> reducedBinary()Description copied from interface:WebSocketMessageReturns the message payload binary data.
This method basically reduces the result of
WebSocketMessage.binary().Note that the returned publisher is exclusive: it is only possible to subscribe to one of the publisher returned by
WebSocketMessage.frames(),WebSocketMessage.binary(),WebSocketMessage.reducedBinary(),WebSocketMessage.text()orWebSocketMessage.reducedText().- Specified by:
reducedBinaryin interfaceWebSocketMessage- Returns:
- a mono emitting the binary payload
-
text
Description copied from interface:WebSocketMessageReturns the message payload text data stream.
Note that the returned publisher is exclusive: it is only possible to subscribe to one of the publisher returned by
WebSocketMessage.frames(),WebSocketMessage.binary(),WebSocketMessage.reducedBinary(),WebSocketMessage.text()orWebSocketMessage.reducedText().- Specified by:
textin interfaceWebSocketMessage- Returns:
- a text publisher
-
reducedText
Description copied from interface:WebSocketMessageReturns the message payload text data stream.
This method basically reduces the result of
WebSocketMessage.text().Note that the returned publisher is exclusive: it is only possible to subscribe to one of the publisher returned by
WebSocketMessage.frames(),WebSocketMessage.binary(),WebSocketMessage.reducedBinary(),WebSocketMessage.text()orWebSocketMessage.reducedText().- Specified by:
reducedTextin interfaceWebSocketMessage- Returns:
- a mono emitting the text payload
-