Interface BaseWeb2SocketExchange.Outbound
- All Superinterfaces:
BaseWebSocketExchange.Outbound
- Enclosing interface:
BaseWeb2SocketExchange<A extends ExchangeContext>
Extends BaseWebSocketExchange.Outbound
to support WebSocket message encoding.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptioncloseOnComplete
(boolean closeOnComplete) Specifies whether the WebSocket exchange should be closed when the frames publisher completes successfully.default <T> void
encodeBinaryMessages
(Publisher<T> messages) Encodes the specified messages to WebSocket binary messages sent to the client.default <T> void
encodeBinaryMessages
(Publisher<T> messages, Class<T> type) Encodes the specified messages of the specified type to WebSocket binary messages sent to the client.<T> void
encodeBinaryMessages
(Publisher<T> messages, Type type) Encodes the specified messages of the specified type to WebSocket binary messages sent to the client.default <T> void
encodeTextMessages
(Publisher<T> messages) Encodes the specified messages to WebSocket text messages sent to the client.default <T> void
encodeTextMessages
(Publisher<T> messages, Class<T> type) Encodes the specified messages of the specified type to WebSocket text messages sent to the client.<T> void
encodeTextMessages
(Publisher<T> messages, Type type) Encodes the specified messages of the specified type to WebSocket text messages sent to the client.Methods inherited from interface io.inverno.mod.http.base.ws.BaseWebSocketExchange.Outbound
frames, messages
-
Method Details
-
closeOnComplete
Description copied from interface:BaseWebSocketExchange.Outbound
Specifies whether the WebSocket exchange should be closed when the frames publisher completes successfully.
When the WebSocket frames publisher completes, it is sometimes desirable to keep the socket opened in order to consume yet to be received messages sent by the remote endpoint before or after receiving the close frame. Note that when the publisher terminates in error, this is considered a failure and the WebSocket exchange is always closed.
The default behaviour is to close the WebSocket exchange.
- Specified by:
closeOnComplete
in interfaceBaseWebSocketExchange.Outbound
- Parameters:
closeOnComplete
- true to close the WebSocket exchange when the frames publisher completes, false otherwise- Returns:
- the outbound
-
encodeTextMessages
Encodes the specified messages to WebSocket text messages sent to the client.
The negotiated subprotocol shall be used to determine the converter to use to encode the message, the subprotocol is then assumed to be a compact application media type (see
MediaTypes.normalizeApplicationMediaType(java.lang.String)
).- Type Parameters:
T
- the type of message to encode- Parameters:
messages
- the messages to send
-
encodeTextMessages
Encodes the specified messages of the specified type to WebSocket text messages sent to the client.
The negotiated subprotocol shall be used to determine the converter to use to encode the message, the subprotocol is then assumed to be a compact application media type (see
MediaTypes.normalizeApplicationMediaType(java.lang.String)
).- Type Parameters:
T
- the type of message to encode- Parameters:
messages
- the messages to sendtype
- the type of message to encode
-
encodeTextMessages
Encodes the specified messages of the specified type to WebSocket text messages sent to the client.
The negotiated subprotocol shall be used to determine the converter to use to encode the message, the subprotocol is then assumed to be a compact application media type (see
MediaTypes.normalizeApplicationMediaType(java.lang.String)
).- Type Parameters:
T
- the type of message to encode- Parameters:
messages
- the messages to sendtype
- the type of message to encode
-
encodeBinaryMessages
Encodes the specified messages to WebSocket binary messages sent to the client.
The negotiated subprotocol shall be used to determine the converter to use to encode the message, the subprotocol is then assumed to be a compact application media type (see
MediaTypes.normalizeApplicationMediaType(java.lang.String)
).- Type Parameters:
T
- the type of message to encode- Parameters:
messages
- the messages to send
-
encodeBinaryMessages
Encodes the specified messages of the specified type to WebSocket binary messages sent to the client.
The negotiated subprotocol shall be used to determine the converter to use to encode the message, the subprotocol is then assumed to be a compact application media type (see
MediaTypes.normalizeApplicationMediaType(java.lang.String)
).- Type Parameters:
T
- the type of message to encode- Parameters:
messages
- the messages to sendtype
- the type of message to encode
-
encodeBinaryMessages
Encodes the specified messages of the specified type to WebSocket binary messages sent to the client.
The negotiated subprotocol shall be used to determine the converter to use to encode the message, the subprotocol is then assumed to be a compact application media type (see
MediaTypes.normalizeApplicationMediaType(java.lang.String)
).- Type Parameters:
T
- the type of message to encode- Parameters:
messages
- the messages to sendtype
- the type of message to encode
-