DefaultWebSocketSession
A default WebSocket session with ping-pong and timeout processing and built-in closeReason population.
Properties
A close reason for this session. It could be null
if a session is terminated with no close reason (for example due to connection failure).
Negotiated WebSocket extensions.
Specifies the frame size limit. A connection will be closed if violated.
Ping interval or null
to disable pinger. Note that pongs will be handled despite this setting.
Specifies the ping interval or disables ping if PINGER_DISABLED is specified. Note that pongs will be handled despite this setting.
A timeout to wait for pong reply to ping, otherwise the session will be terminated immediately. It doesn't have any effect if pingInterval is null
(pinger is disabled).
Specifies a timeout to wait for pong reply to ping; otherwise, the session will be terminated immediately. It doesn't have any effect if pingIntervalMillis is PINGER_DISABLED.
Functions
Sends a close frame with the specified reason. May suspend if the outgoing channel is full. The specified reason could be ignored if there was already close frame sent (for example in reply to a peer close frame). It also may do nothing when a session or an outgoing channel is already closed due to any reason.
Closes a session with normal or error close reason, depending on whether cause is cancellation or not.
Finds the extensions using WebSocketExtensionFactory.
Searches the extensions using WebSocketExtensionFactory.
Flushes all outstanding messages and suspends until all earlier sent messages will be written. Could be called at any time even after close. May return immediately if the connection is already terminated. However, it may also fail with an exception (or cancellation) at any point due to a session failure. Note that flush doesn't guarantee that frames were actually delivered.
Enqueue a frame, may suspend if an outgoing queue is full. May throw an exception if the outgoing channel is already closed, so it is impossible to transfer any message. Frames that were sent after close frame could be silently ignored. Note that a close frame could be sent automatically in reply to a peer's close frame unless it is raw WebSocket session.
Starts a WebSocket conversation.