org.springframework.web.reactive.socket.adapter

## Class ReactorNettyWebSocketSession

- java.lang.Object
- - org.springframework.web.reactive.socket.adapter.AbstractWebSocketSession<T>
  - - org.springframework.web.reactive.socket.adapter.NettyWebSocketSessionSupport<ReactorNettyWebSocketSession.WebSocketConnection>
    - - org.springframework.web.reactive.socket.adapter.ReactorNettyWebSocketSession

All Implemented Interfaces:
  WebSocketSession

    public class ReactorNettyWebSocketSession
    extends NettyWebSocketSessionSupport<ReactorNettyWebSocketSession.WebSocketConnection>

`WebSocketSession` implementation for use with the Reactor Netty's `NettyInbound` and `NettyOutbound`.

Since:
  5.0
Author:
  Rossen Stoyanchev

### Nested Class Summary

Nested Classes
`static class` `ReactorNettyWebSocketSession.WebSocketConnection` Simple container for `NettyInbound` and `NettyOutbound`.

### Field Summary

### Fields inherited from class org.springframework.web.reactive.socket.adapter.NettyWebSocketSessionSupport

`DEFAULT_FRAME_MAX_SIZE`

### Fields inherited from class org.springframework.web.reactive.socket.adapter.AbstractWebSocketSession

`logger`

### Constructor Summary

Constructors
Constructor and Description
`ReactorNettyWebSocketSession(reactor.netty.http.websocket.WebsocketInbound inbound, reactor.netty.http.websocket.WebsocketOutbound outbound, HandshakeInfo info, org.springframework.core.io.buffer.NettyDataBufferFactory bufferFactory)` Constructor for the session, using the `NettyWebSocketSessionSupport.DEFAULT_FRAME_MAX_SIZE` value.
`ReactorNettyWebSocketSession(reactor.netty.http.websocket.WebsocketInbound inbound, reactor.netty.http.websocket.WebsocketOutbound outbound, HandshakeInfo info, org.springframework.core.io.buffer.NettyDataBufferFactory bufferFactory, int maxFramePayloadLength)` Constructor with an additional maxFramePayloadLength argument.

### Method Summary

All Methods Instance Methods Concrete Methods
`reactor.core.publisher.Mono<Void>` `close(CloseStatus status)` Close the WebSocket session with the given status.
`reactor.core.publisher.Flux<WebSocketMessage>` `receive()` Provides access to the stream of inbound messages.
`reactor.core.publisher.Mono<Void>` `send(org.reactivestreams.Publisher<WebSocketMessage> messages)` Give a source of outgoing messages, write the messages and return a `Mono<Void>` that completes when the source completes and writing is done.

### Methods inherited from class org.springframework.web.reactive.socket.adapter.NettyWebSocketSessionSupport

`bufferFactory, toFrame, toMessage`

### Methods inherited from class org.springframework.web.reactive.socket.adapter.AbstractWebSocketSession

`binaryMessage, getAttributes, getDelegate, getHandshakeInfo, getId, getLogPrefix, pingMessage, pongMessage, textMessage, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.springframework.web.reactive.socket.WebSocketSession

`close`

### Constructor Detail

#### ReactorNettyWebSocketSession

    public ReactorNettyWebSocketSession(reactor.netty.http.websocket.WebsocketInbound inbound,
                                        reactor.netty.http.websocket.WebsocketOutbound outbound,
                                        HandshakeInfo info,
                                        org.springframework.core.io.buffer.NettyDataBufferFactory bufferFactory)

Constructor for the session, using the `NettyWebSocketSessionSupport.DEFAULT_FRAME_MAX_SIZE` value.

#### ReactorNettyWebSocketSession

    public ReactorNettyWebSocketSession(reactor.netty.http.websocket.WebsocketInbound inbound,
                                        reactor.netty.http.websocket.WebsocketOutbound outbound,
                                        HandshakeInfo info,
                                        org.springframework.core.io.buffer.NettyDataBufferFactory bufferFactory,
                                        int maxFramePayloadLength)

Constructor with an additional maxFramePayloadLength argument.

Since:
  5.1

### Method Detail

#### receive

    public reactor.core.publisher.Flux<WebSocketMessage> receive()

Description copied from interface: `WebSocketSession`
Provides access to the stream of inbound messages.

This stream receives a completion or error signal when the connection is closed. In a typical `WebSocketHandler` implementation this stream is composed into the overall processing flow, so that when the connection is closed, handling will end.

See the class-level doc of `WebSocketHandler` and the reference for more details and examples of how to handle the session.

Specified by:
  `receive` in interface `WebSocketSession`
Specified by:
  `receive` in class `AbstractWebSocketSession<ReactorNettyWebSocketSession.WebSocketConnection>`

#### send

    public reactor.core.publisher.Mono<Void> send(org.reactivestreams.Publisher<WebSocketMessage> messages)

Description copied from interface: `WebSocketSession`
Give a source of outgoing messages, write the messages and return a `Mono<Void>` that completes when the source completes and writing is done.

See the class-level doc of `WebSocketHandler` and the reference for more details and examples of how to handle the session.

Specified by:
  `send` in interface `WebSocketSession`
Specified by:
  `send` in class `AbstractWebSocketSession<ReactorNettyWebSocketSession.WebSocketConnection>`

#### close

    public reactor.core.publisher.Mono<Void> close(CloseStatus status)

Description copied from interface: `WebSocketSession`
Close the WebSocket session with the given status.

Parameters:
  `status` - the close status