Class JakartaWebSocketFrameHandler
- All Implemented Interfaces:
FrameHandler
,IncomingFrames
-
Field Summary
-
Constructor Summary
ConstructorDescriptionJakartaWebSocketFrameHandler
(JakartaWebSocketContainer container, UpgradeRequest upgradeRequest, Object endpointInstance, MethodHandle openHandle, MethodHandle closeHandle, MethodHandle errorHandle, JakartaWebSocketMessageMetadata textMetadata, JakartaWebSocketMessageMetadata binaryMetadata, MethodHandle pongHandle, jakarta.websocket.EndpointConfig endpointConfig) -
Method Summary
Modifier and TypeMethodDescription<T> void
addMessageHandler
(Class<T> clazz, jakarta.websocket.MessageHandler.Partial<T> handler) <T> void
addMessageHandler
(Class<T> clazz, jakarta.websocket.MessageHandler.Whole<T> handler) jakarta.websocket.EndpointConfig
Set<jakarta.websocket.MessageHandler>
void
void
void
onClosed
(CloseStatus closeStatus, Callback callback) Invoked when a WebSocket close event happened.void
onContinuation
(Frame frame, Callback callback) void
Invoked when an error has occurred or has been detected.void
Invoked when a WebSocket frame is received.void
onOpen
(CoreSession coreSession, Callback callback) Invoked when the WebSocket connection is opened.void
void
void
void
removeMessageHandler
(jakarta.websocket.MessageHandler handler) toString()
-
Field Details
-
dataType
protected byte dataType
-
-
Constructor Details
-
JakartaWebSocketFrameHandler
public JakartaWebSocketFrameHandler(JakartaWebSocketContainer container, UpgradeRequest upgradeRequest, Object endpointInstance, MethodHandle openHandle, MethodHandle closeHandle, MethodHandle errorHandle, JakartaWebSocketMessageMetadata textMetadata, JakartaWebSocketMessageMetadata binaryMetadata, MethodHandle pongHandle, jakarta.websocket.EndpointConfig endpointConfig)
-
-
Method Details
-
getEndpoint
-
getEndpointConfig
public jakarta.websocket.EndpointConfig getEndpointConfig() -
getSession
-
onOpen
Description copied from interface:FrameHandler
Invoked when the WebSocket connection is opened.
It is allowed to send WebSocket frames via
OutgoingFrames.sendFrame(Frame, Callback, boolean)
.WebSocket frames cannot be received until a call to
CoreSession.demand()
is made.If the callback argument is failed, the implementation sends a CLOSE frame with
CloseStatus.SERVER_ERROR
, and the connection will be closed.- Specified by:
onOpen
in interfaceFrameHandler
- Parameters:
coreSession
- the session associated with this connection.callback
- the callback to indicate success or failure of the processing of this event.
-
onFrame
Description copied from interface:FrameHandler
Invoked when a WebSocket frame is received.
This method will never be called concurrently for the same session; will be called sequentially to satisfy the outstanding demand signaled by calls to
CoreSession.demand()
.Both control and data frames are passed to this method.
CLOSE frames may be responded from this method, but if they are not responded, then the implementation will respond when the callback is completed.
The callback argument must be completed to indicate that the buffers associated with the frame can be recycled.
Additional WebSocket frames (of any type, including CLOSE frames) cannot be received until a call to
CoreSession.demand()
is made.- Specified by:
onFrame
in interfaceFrameHandler
- Specified by:
onFrame
in interfaceIncomingFrames
- Parameters:
frame
- the WebSocket frame.callback
- the callback to indicate success or failure of the processing of this event.
-
onClose
-
onClosed
Description copied from interface:FrameHandler
Invoked when a WebSocket close event happened.
The WebSocket connection is closed, no reading or writing is possible anymore.
Implementations of this method may cleanup resources that have been allocated.
This method will not be called more than once.
- Specified by:
onClosed
in interfaceFrameHandler
- Parameters:
closeStatus
- the close status received from the remote peer, or generated locally in the case of abnormal closures.callback
- the callback to indicate success or failure of the processing of this event.
-
onError
Description copied from interface:FrameHandler
Invoked when an error has occurred or has been detected.
A call to this method will be followed by a call to
FrameHandler.onClosed(CloseStatus, Callback)
with the close status derived from the error.This method will not be called more than once,
FrameHandler.onClosed(CloseStatus, Callback)
will be called on the callback completion.- Specified by:
onError
in interfaceFrameHandler
- Parameters:
cause
- the error causecallback
- the callback to indicate success or failure of the processing of this event.
-
getMessageHandlers
-
getMessageHandlerMap
-
getBinaryMetadata
-
getTextMetadata
-
addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, jakarta.websocket.MessageHandler.Partial<T> handler) -
addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, jakarta.websocket.MessageHandler.Whole<T> handler) -
removeMessageHandler
public void removeMessageHandler(jakarta.websocket.MessageHandler handler) -
toString
-
onPing
-
onPong
-
onText
-
onBinary
-
onContinuation
-
getUpgradeRequest
-