Interface CoreSession
- All Superinterfaces:
Configuration
,IncomingFrames
,OutgoingFrames
- All Known Implementing Classes:
CoreSession.Empty
,WebSocketCoreSession
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.websocket.core.Configuration
Configuration.ConfigurationCustomizer, Configuration.Customizer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Issue a harsh abort of the underlying connection.void
Initiate close handshake with provided status code and optional reason phrase.void
Initiate close handshake, no payload (no declared status code or reason phrase).default void
close
(CloseStatus closeStatus, Callback callback) Initiate close handshake with a providedCloseStatus
.void
demand()
Manages flow control by indicating demand for a WebSocket frame.void
The Local Socket Address for the connectionThe negotiated WebSocket Extension Configurations for this session.The parameter map (from URI Query) for the active session.The activeSec-WebSocket-Version
(protocol version) in use.The Remote Socket Address for the connectionThe active connection's Request URI.boolean
isClosed()
boolean
boolean
boolean
boolean
boolean
boolean
isSecure()
The active connection's Secure status indicator.Methods inherited from interface org.eclipse.jetty.websocket.core.Configuration
getIdleTimeout, getInputBufferSize, getMaxBinaryMessageSize, getMaxFrameSize, getMaxOutgoingFrames, getMaxTextMessageSize, getOutputBufferSize, getWriteTimeout, isAutoFragment, setAutoFragment, setIdleTimeout, setInputBufferSize, setMaxBinaryMessageSize, setMaxFrameSize, setMaxOutgoingFrames, setMaxTextMessageSize, setOutputBufferSize, setWriteTimeout
Methods inherited from interface org.eclipse.jetty.websocket.core.IncomingFrames
onFrame
Methods inherited from interface org.eclipse.jetty.websocket.core.OutgoingFrames
sendFrame
-
Method Details
-
getNegotiatedSubProtocol
String getNegotiatedSubProtocol() -
getNegotiatedExtensions
List<ExtensionConfig> getNegotiatedExtensions()The negotiated WebSocket Extension Configurations for this session.- Returns:
- the list of Negotiated Extension Configurations for this session.
-
getParameterMap
The parameter map (from URI Query) for the active session.- Returns:
- the immutable map of parameters
-
getProtocolVersion
String getProtocolVersion()The activeSec-WebSocket-Version
(protocol version) in use.- Returns:
- the protocol version in use.
-
getRequestURI
URI getRequestURI()The active connection's Request URI. This is the URI of the upgrade request and is typically http: or https: rather than the ws: or wss: scheme.- Returns:
- the absolute URI (including Query string)
-
isSecure
boolean isSecure()The active connection's Secure status indicator.- Returns:
- true if connection is secure (similar in role to
HttpServletRequest.isSecure()
)
-
getBehavior
Behavior getBehavior()- Returns:
- Client or Server behaviour
-
getWebSocketComponents
WebSocketComponents getWebSocketComponents()- Returns:
- the WebSocketComponents instance in use for this Connection.
-
getByteBufferPool
ByteBufferPool getByteBufferPool()- Returns:
- The shared ByteBufferPool
-
getLocalAddress
SocketAddress getLocalAddress()The Local Socket Address for the connectionDo not assume that this will return a
InetSocketAddress
in all cases. Use of various proxies, and even UnixSockets can result a SocketAddress being returned without supportingInetSocketAddress
- Returns:
- the SocketAddress for the local connection, or null if not supported by Session
-
getRemoteAddress
SocketAddress getRemoteAddress()The Remote Socket Address for the connectionDo not assume that this will return a
InetSocketAddress
in all cases. Use of various proxies, and even UnixSockets can result a SocketAddress being returned without supportingInetSocketAddress
- Returns:
- the SocketAddress for the remote connection, or null if not supported by Session
-
isInputOpen
boolean isInputOpen()- Returns:
- True if the websocket is open inbound
-
isOutputOpen
boolean isOutputOpen()- Returns:
- True if the websocket is open outbound
-
isClosed
boolean isClosed() -
flush
-
close
Initiate close handshake, no payload (no declared status code or reason phrase).- Parameters:
callback
- the callback to track close frame sent (or failed).
-
close
Initiate close handshake with provided status code and optional reason phrase.- Parameters:
statusCode
- the status code (should be a valid status code that can be sent).reason
- optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol).callback
- the callback to track close frame sent (or failed).
-
close
Initiate close handshake with a providedCloseStatus
.- Parameters:
closeStatus
- the close status containing (statusCode, reason, and optionalThrowable
cause).callback
- the callback to track close frame sent (or failed).
-
abort
void abort()Issue a harsh abort of the underlying connection.This will terminate the connection, without sending a websocket close frame. No WebSocket Protocol close handshake will be performed.
Once called, any read/write activity on the websocket from this point will be indeterminate. This can result in the
FrameHandler.onError(Throwable, Callback)
event being called indicating any issue that arises.Once the underlying connection has been determined to be closed, the
FrameHandler.onClosed(CloseStatus, Callback)
event will be called. -
demand
void demand()Manages flow control by indicating demand for a WebSocket frame.
A call to
FrameHandler.onFrame(Frame, Callback)
will only be made if there is demand.If a previous demand has not been fulfilled this will throw
ReadPendingException
FrameHandler.onFrame(Frame, Callback)
. -
isRsv1Used
boolean isRsv1Used()- Returns:
- true if an extension has been negotiated which uses the RSV1 bit.
-
isRsv2Used
boolean isRsv2Used()- Returns:
- true if an extension has been negotiated which uses the RSV2 bit.
-
isRsv3Used
boolean isRsv3Used()- Returns:
- true if an extension has been negotiated which uses the RSV3 bit.
-