Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.socket.adapter

public Class ReactorNetty2WebSocketSession

extends Netty5WebSocketSessionSupport<ReactorNetty2WebSocketSession.WebSocketConnection>
Class Inheritance
Imports
java.util.function.Consumer, io.netty5.channel.ChannelId, io.netty5.handler.codec.http.websocketx.WebSocketFrame, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, reactor.netty5.Connection, .NettyInbound, .NettyOutbound, reactor.netty5.channel.ChannelOperations, reactor.netty5.http.websocket.WebsocketInbound, .WebsocketOutbound, org.springframework.core.io.buffer.Netty5DataBufferFactory, org.springframework.web.reactive.socket.CloseStatus, .HandshakeInfo, .WebSocketMessage, .WebSocketSession

WebSocketSession implementation for use with the Reactor Netty's (Netty 5) NettyInbound and NettyOutbound. This class is based on ReactorNettyWebSocketSession.
Author
Violeta Georgieva
Since
6.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class

Field Summary

Modifier and TypeField and Description
private final ChannelId
private final int
Inherited from org.springframework.web.reactive.socket.adapter.Netty5WebSocketSessionSupport:
DEFAULT_FRAME_MAX_SIZE

Constructor Summary

AccessConstructor and Description
public
ReactorNetty2WebSocketSession(WebsocketInbound inbound, WebsocketOutbound outbound, HandshakeInfo info, Netty5DataBufferFactory bufferFactory)

Constructor for the session, using the DEFAULT_FRAME_MAX_SIZE value.

public
ReactorNetty2WebSocketSession(WebsocketInbound inbound, WebsocketOutbound outbound, HandshakeInfo info, Netty5DataBufferFactory bufferFactory, int maxFramePayloadLength)

Constructor with an additional maxFramePayloadLength argument.

Method Summary

Modifier and TypeMethod and Description
public Mono<Void>
close(CloseStatus
the close status
status
)

Implements org.springframework.web.reactive.socket.WebSocketSession.close.

Close the WebSocket session with the given status.

public Mono<CloseStatus>
closeStatus()

Implements org.springframework.web.reactive.socket.WebSocketSession.closeStatus.

Provides access to the CloseStatus with which the session is closed either locally or remotely, or completes empty if the session ended without a status.

public ChannelId
getChannelId()

Return the id of the underlying Netty channel.

public boolean
isOpen()

Implements org.springframework.web.reactive.socket.WebSocketSession.isOpen.

Whether the underlying connection is open.

public Flux<WebSocketMessage>
public Mono<Void>
send(Publisher<WebSocketMessage> messages)

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractWebSocketSession.send.

Implements org.springframework.web.reactive.socket.WebSocketSession.send.

Give a source of outgoing messages, write the messages and return a Mono<Void> that completes when the source completes and writing is done.

Inherited from org.springframework.web.reactive.socket.adapter.Netty5WebSocketSessionSupport:
bufferFactorytoFrametoMessage

Field Detail

channelIdback to summary
private final ChannelId channelId
maxFramePayloadLengthback to summary
private final int maxFramePayloadLength

Constructor Detail

ReactorNetty2WebSocketSessionback to summary
public ReactorNetty2WebSocketSession(WebsocketInbound inbound, WebsocketOutbound outbound, HandshakeInfo info, Netty5DataBufferFactory bufferFactory)

Constructor for the session, using the DEFAULT_FRAME_MAX_SIZE value.

ReactorNetty2WebSocketSessionback to summary
public ReactorNetty2WebSocketSession(WebsocketInbound inbound, WebsocketOutbound outbound, HandshakeInfo info, Netty5DataBufferFactory bufferFactory, int maxFramePayloadLength)

Constructor with an additional maxFramePayloadLength argument.

Annotations
@SuppressWarnings:rawtypes
Since
5.1

Method Detail

closeback to summary
public Mono<Void> close(CloseStatus status)

Implements org.springframework.web.reactive.socket.WebSocketSession.close.

Doc from org.springframework.web.reactive.socket.WebSocketSession.close.

Close the WebSocket session with the given status.

Parameters
status:CloseStatus

the close status

Annotations
@Override
closeStatusback to summary
public Mono<CloseStatus> closeStatus()

Implements org.springframework.web.reactive.socket.WebSocketSession.closeStatus.

Doc from org.springframework.web.reactive.socket.WebSocketSession.closeStatus.

Provides access to the CloseStatus with which the session is closed either locally or remotely, or completes empty if the session ended without a status.

Annotations
@Override
getChannelIdback to summary
public ChannelId getChannelId()

Return the id of the underlying Netty channel.

Since
5.3.4
isOpenback to summary
public boolean isOpen()

Implements org.springframework.web.reactive.socket.WebSocketSession.isOpen.

Doc from org.springframework.web.reactive.socket.WebSocketSession.isOpen.

Whether the underlying connection is open.

Annotations
@Override
receiveback to summary
public Flux<WebSocketMessage> receive()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractWebSocketSession.receive.

Implements org.springframework.web.reactive.socket.WebSocketSession.receive.

Doc from org.springframework.web.reactive.socket.WebSocketSession.receive.

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.

Annotations
@Override
sendback to summary
public Mono<Void> send(Publisher<WebSocketMessage> messages)

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractWebSocketSession.send.

Implements org.springframework.web.reactive.socket.WebSocketSession.send.

Doc from org.springframework.web.reactive.socket.WebSocketSession.send.

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.

Annotations
@Override
org.springframework.web.reactive.socket.adapter back to summary

private Class ReactorNetty2WebSocketSession.DisposedCallback

extends Object
implements Consumer<Connection>
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.socket.adapter.ReactorNetty2WebSocketSession.DisposedCallback
All Implemented Interfaces
java.util.function.Consumer

Field Summary

Modifier and TypeField and Description
private boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
accept(Connection
the input argument
connection
)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

disposedback to summary
private boolean disposed

Constructor Detail

DisposedCallbackback to summary
private DisposedCallback()

Method Detail

acceptback to summary
public void accept(Connection connection)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Parameters
connection:Connection

the input argument

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()
org.springframework.web.reactive.socket.adapter back to summary

public Class ReactorNetty2WebSocketSession.WebSocketConnection

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.socket.adapter.ReactorNetty2WebSocketSession.WebSocketConnection

Simple container for NettyInbound and NettyOutbound.

Field Summary

Modifier and TypeField and Description
private final WebsocketInbound
private final WebsocketOutbound

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public WebsocketInbound
public WebsocketOutbound
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inboundback to summary
private final WebsocketInbound inbound
outboundback to summary
private final WebsocketOutbound outbound

Constructor Detail

WebSocketConnectionback to summary
public WebSocketConnection(WebsocketInbound inbound, WebsocketOutbound outbound)

Method Detail

getInboundback to summary
public WebsocketInbound getInbound()
getOutboundback to summary
public WebsocketOutbound getOutbound()