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

public Class StandardWebSocketSession

extends AbstractListenerWebSocketSession<Session>
Class Inheritance
Known Direct Subclasses
org.springframework.web.reactive.socket.adapter.TomcatWebSocketSession
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, jakarta.websocket.CloseReason, .CloseReason.CloseCodes, .RemoteEndpoint, .SendHandler, .SendResult, .Session, reactor.core.publisher.Mono, .Sinks, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, org.springframework.lang.Nullable, org.springframework.web.reactive.socket.CloseStatus, .HandshakeInfo, .WebSocketMessage, .WebSocketSession

Spring WebSocketSession adapter for a standard Java (JSR 356) jakarta.websocket.Session.
Authors
Violeta Georgieva, Rossen Stoyanchev
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
canSuspendReceiving()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.canSuspendReceiving.

Whether the underlying WebSocket API has flow control and can suspend and resume the receiving of messages.

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 boolean
isOpen()

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

Whether the underlying connection is open.

protected void
resumeReceiving()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.resumeReceiving.

Resume receiving new message(s) after demand is generated by the downstream Subscriber.

protected boolean
protected void
suspendReceiving()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.suspendReceiving.

Suspend receiving until received message(s) are processed and more demand is generated by the downstream Subscriber.

Inherited from org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession:
closeStatusgetSendProcessorhandleClosehandleErrorhandleMessageonCompleteonErroronNextonSubscribereceivesend

Constructor Detail

StandardWebSocketSessionback to summary
public StandardWebSocketSession(Session session, HandshakeInfo info, DataBufferFactory factory)
StandardWebSocketSessionback to summary
public StandardWebSocketSession(Session session, HandshakeInfo info, DataBufferFactory factory, Sinks.Empty<Void> completionSink)

Method Detail

canSuspendReceivingback to summary
protected boolean canSuspendReceiving()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.canSuspendReceiving.

Doc from org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.canSuspendReceiving.

Whether the underlying WebSocket API has flow control and can suspend and resume the receiving of messages.

Note

Sub-classes are encouraged to start out in suspended mode, if possible, and wait until demand is received.

Annotations
@Override
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
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
resumeReceivingback to summary
protected void resumeReceiving()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.resumeReceiving.

Doc from org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.resumeReceiving.

Resume receiving new message(s) after demand is generated by the downstream Subscriber.

Note

if the underlying WebSocket API does not provide flow control for receiving messages, this method should be a no-op and canSuspendReceiving() should return false.

Annotations
@Override
sendMessageback to summary
protected boolean sendMessage(WebSocketMessage message) throws IOException

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.sendMessage.

Doc from org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.sendMessage.

Send the given WebSocket message.

Note

Sub-classes are responsible for releasing the payload data buffer, once fully written, if pooled buffers apply to the underlying container.

Annotations
@Override
suspendReceivingback to summary
protected void suspendReceiving()

Implements abstract org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.suspendReceiving.

Doc from org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.suspendReceiving.

Suspend receiving until received message(s) are processed and more demand is generated by the downstream Subscriber.

Note

if the underlying WebSocket API does not provide flow control for receiving messages, this method should be a no-op and canSuspendReceiving() should return false.

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

private final Class StandardWebSocketSession.SendProcessorCallback

extends Object
implements SendHandler
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.socket.adapter.StandardWebSocketSession.SendProcessorCallback
All Implemented Interfaces
jakarta.websocket.SendHandler

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Constructor Detail

SendProcessorCallbackback to summary
private SendProcessorCallback()

Method Detail

onResultback to summary
public void onResult(SendResult result)

Implements jakarta.websocket.SendHandler.onResult.

Annotations
@Override