Interface BaseWebSocketExchange.Outbound

All Known Subinterfaces:
Web2SocketExchange.Outbound
Enclosing interface:
BaseWebSocketExchange<A extends ExchangeContext>

public static interface BaseWebSocketExchange.Outbound

Represents the outbound part of a WebSocket exchange.

It allows to set the stream of frames or messages that must be sent to the client by the server or to the server by the client. It is only possible to specify either a stream of frames or a stream of messages.

Since:
1.5
Author:
Jeremy Kuhn
  • Method Details

    • closeOnComplete

      BaseWebSocketExchange.Outbound closeOnComplete(boolean closeOnComplete)

      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.

      Parameters:
      closeOnComplete - true to close the WebSocket exchange when the frames publisher completes, false otherwise
      Returns:
      the outound
    • frames

      Sets the stream of frames to send.

      WebSocket frames should be created using the provided WebSocketFrame.Factory.

      By default, the WebSocket exchange is closed when the frames publisher completes, invoke closeOnComplete(boolean) to change that behaviour.

      Parameters:
      frames - a function that returns a publisher of WebSocket frames created using the provided factory
    • messages

      Sets the stream of messages to send.

      WebSocket messages should be created using the provided WebSocketMessage.Factory.

      By default, the WebSocket exchange is closed when the messages publisher completes, invoke closeOnComplete(boolean) to change that behaviour.

      Parameters:
      messages - a function that returns a publisher of WebSocket messages created using the provided factory