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

public Class JettyWebSocketSession

extends AbstractListenerWebSocketSession<Session>
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, org.eclipse.jetty.websocket.api.Callback, .Session, reactor.core.publisher.Mono, .Sinks, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils, org.springframework.web.reactive.socket.CloseStatus, .HandshakeInfo, .WebSocketMessage, .WebSocketSession

Spring WebSocketSession implementation that adapts to a Jetty WebSocket org.eclipse.jetty.websocket.api.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
JettyWebSocketSession(Session session, HandshakeInfo info, DataBufferFactory factory, Sinks.Empty<Void> completionSink)

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

JettyWebSocketSessionback to summary
public JettyWebSocketSession(Session session, HandshakeInfo info, DataBufferFactory factory)
JettyWebSocketSessionback to summary
public JettyWebSocketSession(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 JettyWebSocketSession.SendProcessorCallback

extends Object
implements Callback
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.socket.adapter.JettyWebSocketSession.SendProcessorCallback

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Constructor Detail

SendProcessorCallbackback to summary
private SendProcessorCallback()

Method Detail

failback to summary
public void fail(Throwable x)
Annotations
@Override
succeedback to summary
public void succeed()
Annotations
@Override