Class AbstractListenerWebSocketSession.WebSocketSendProcessor
java.lang.Object
org.springframework.http.server.reactive.AbstractListenerWriteProcessor<WebSocketMessage>
org.springframework.web.reactive.socket.adapter.AbstractListenerWebSocketSession.WebSocketSendProcessor
- All Implemented Interfaces:
Processor<WebSocketMessage,
,Void> Publisher<Void>
,Subscriber<WebSocketMessage>
- Enclosing class:
- AbstractListenerWebSocketSession<T>
protected final class AbstractListenerWebSocketSession.WebSocketSendProcessor
extends AbstractListenerWriteProcessor<WebSocketMessage>
Write processor for outbound WebSocket messages.
-
Field Summary
Fields inherited from class org.springframework.http.server.reactive.AbstractListenerWriteProcessor
rsWriteLogger
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
discardData
(WebSocketMessage message) Invoked after any error (either from the upstream write Publisher, or from I/O operations to the underlying server) and cancellation to discard in-flight data that was in the process of being written when the error took place.protected boolean
isDataEmpty
(WebSocketMessage message) Whether the given data item has any content to write.protected boolean
Whether writing is possible.void
setReadyToSend
(boolean ready) Subclasses can invoke this before sending a message (false) and after receiving the async send callback (true) effective translating async completion callback into simple flow control.protected boolean
write
(WebSocketMessage message) Write the given item.Methods inherited from class org.springframework.http.server.reactive.AbstractListenerWriteProcessor
cancel, dataReceived, getLogPrefix, onComplete, onError, onNext, onSubscribe, onWritePossible, subscribe, writingComplete, writingFailed, writingPaused
-
Method Details
-
write
Description copied from class:AbstractListenerWriteProcessor
Write the given item.Note: Sub-classes are responsible for releasing any data buffer associated with the item, once fully written, if pooled buffers apply to the underlying container.
- Specified by:
write
in classAbstractListenerWriteProcessor<WebSocketMessage>
- Parameters:
message
- the item to write- Returns:
true
if the current data item was written completely and a new item requested, orfalse
if it was written partially and we'll need more write callbacks before it is fully written- Throws:
IOException
-
isDataEmpty
Description copied from class:AbstractListenerWriteProcessor
Whether the given data item has any content to write. If false the item is not written.- Specified by:
isDataEmpty
in classAbstractListenerWriteProcessor<WebSocketMessage>
-
isWritePossible
protected boolean isWritePossible()Description copied from class:AbstractListenerWriteProcessor
Whether writing is possible.- Specified by:
isWritePossible
in classAbstractListenerWriteProcessor<WebSocketMessage>
-
setReadyToSend
public void setReadyToSend(boolean ready) Subclasses can invoke this before sending a message (false) and after receiving the async send callback (true) effective translating async completion callback into simple flow control. -
discardData
Description copied from class:AbstractListenerWriteProcessor
Invoked after any error (either from the upstream write Publisher, or from I/O operations to the underlying server) and cancellation to discard in-flight data that was in the process of being written when the error took place.- Specified by:
discardData
in classAbstractListenerWriteProcessor<WebSocketMessage>
- Parameters:
message
- the data to be released
-