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

public Class UndertowWebSocketSession

extends AbstractListenerWebSocketSession<WebSocketChannel>
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, io.undertow.websockets.core.CloseMessage, .WebSocketCallback, .WebSocketChannel, .WebSockets, reactor.core.publisher.Mono, .Sinks, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, .DataBufferUtils, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils, org.springframework.web.reactive.socket.CloseStatus, .HandshakeInfo, .WebSocketMessage, .WebSocketSession

Spring WebSocketSession implementation that adapts to an Undertow io.undertow.websockets.core.WebSocketChannel.
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

UndertowWebSocketSessionback to summary
public UndertowWebSocketSession(WebSocketChannel channel, HandshakeInfo info, DataBufferFactory factory)
UndertowWebSocketSessionback to summary
public UndertowWebSocketSession(WebSocketChannel channel, 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 UndertowWebSocketSession.SendProcessorCallback

extends Object
implements WebSocketCallback<Void>
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.socket.adapter.UndertowWebSocketSession.SendProcessorCallback
All Implemented Interfaces
io.undertow.websockets.core.WebSocketCallback

Field Summary

Modifier and TypeField and Description
private final DataBuffer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

Field Detail

payloadback to summary
private final DataBuffer payload

Constructor Detail

SendProcessorCallbackback to summary
pack-priv SendProcessorCallback(DataBuffer payload)

Method Detail

completeback to summary
public void complete(WebSocketChannel channel, Void context)

Implements io.undertow.websockets.core.WebSocketCallback.complete.

Annotations
@Override
onErrorback to summary
public void onError(WebSocketChannel channel, Void context, Throwable throwable)

Implements io.undertow.websockets.core.WebSocketCallback.onError.

Annotations
@Override