Top Description Inners Methods
org.eclipse.jetty.websocket.core

public Interface CoreSession

extends OutgoingFrames, IncomingFrames, Configuration
Known Direct Implementers
org.eclipse.jetty.websocket.core.CoreSession.Empty, org.eclipse.jetty.websocket.core.WebSocketCoreSession
Imports
java.net.InetSocketAddress, .SocketAddress, .URI, java.nio.channels.ReadPendingException, java.util.List, .Map, org.eclipse.jetty.io.ByteBufferPool, org.eclipse.jetty.util.Callback

Represents the outgoing Frames.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Method Summary

Modifier and TypeMethod and Description
public void
abort()

Issue a harsh abort of the underlying connection.

public void
close(Callback
the callback to track close frame sent (or failed).
callback
)

Initiate close handshake, no payload (no declared status code or reason phrase).

public void
close(int
the status code (should be a valid status code that can be sent).
statusCode
,
String
optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol).
reason
,
Callback
the callback to track close frame sent (or failed).
callback
)

Initiate close handshake with provided status code and optional reason phrase.

public default void
close(CloseStatus
the close status containing (statusCode, reason, and optional Throwable cause).
closeStatus
,
Callback
the callback to track close frame sent (or failed).
callback
)

Initiate close handshake with a provided CloseStatus.

public void
demand()

Manages flow control by indicating demand for a WebSocket frame.

public void
flush(Callback callback)

public Behavior
getBehavior()

Returns: Client or Server behaviour

public ByteBufferPool
getByteBufferPool()

Returns: The shared ByteBufferPool

public SocketAddress

Returns:

the SocketAddress for the local connection, or null if not supported by Session
getLocalAddress
()

The Local Socket Address for the connection

Do not assume that this will return a InetSocketAddress in all cases.

public List<ExtensionConfig>

Returns:

the list of Negotiated Extension Configurations for this session.
getNegotiatedExtensions
()

The negotiated WebSocket Extension Configurations for this session.

public String
public Map<String, List<String>>

Returns:

the immutable map of parameters
getParameterMap
()

The parameter map (from URI Query) for the active session.

public String

Returns:

the protocol version in use.
getProtocolVersion
()

The active Sec-WebSocket-Version (protocol version) in use.

public SocketAddress

Returns:

the SocketAddress for the remote connection, or null if not supported by Session
getRemoteAddress
()

The Remote Socket Address for the connection

Do not assume that this will return a InetSocketAddress in all cases.

public URI

Returns:

the absolute URI (including Query string)
getRequestURI
()

The active connection's Request URI.

public WebSocketComponents
getWebSocketComponents()

Returns: the WebSocketComponents instance in use for this Connection.

public boolean
public boolean
isInputOpen()

Returns: True if the websocket is open inbound

public boolean
isOutputOpen()

Returns: True if the websocket is open outbound

public boolean
isRsv1Used()

Returns: true if an extension has been negotiated which uses the RSV1 bit.

public boolean
isRsv2Used()

Returns: true if an extension has been negotiated which uses the RSV2 bit.

public boolean
isRsv3Used()

Returns: true if an extension has been negotiated which uses the RSV3 bit.

public boolean

Returns:

true if connection is secure (similar in role to HttpServletRequest.isSecure())
isSecure
()

The active connection's Secure status indicator.

Inherited from org.eclipse.jetty.websocket.core.Configuration:
getIdleTimeoutgetInputBufferSizegetMaxBinaryMessageSizegetMaxFrameSizegetMaxOutgoingFramesgetMaxTextMessageSizegetOutputBufferSizegetWriteTimeoutisAutoFragmentsetAutoFragmentsetIdleTimeoutsetInputBufferSizesetMaxBinaryMessageSizesetMaxFrameSizesetMaxOutgoingFramessetMaxTextMessageSizesetOutputBufferSizesetWriteTimeout
Inherited from org.eclipse.jetty.websocket.core.IncomingFrames:
onFrame
Inherited from org.eclipse.jetty.websocket.core.OutgoingFrames:
sendFrame

Method Detail

abortback to summary
public 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.

closeback to summary
public void close(Callback callback)

Initiate close handshake, no payload (no declared status code or reason phrase).

Parameters
callback:Callback

the callback to track close frame sent (or failed).

closeback to summary
public void close(int statusCode, String reason, Callback callback)

Initiate close handshake with provided status code and optional reason phrase.

Parameters
statusCode:int

the status code (should be a valid status code that can be sent).

reason:String

optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol).

callback:Callback

the callback to track close frame sent (or failed).

closeback to summary
public default void close(CloseStatus closeStatus, Callback callback)

Initiate close handshake with a provided CloseStatus.

Parameters
closeStatus:CloseStatus

the close status containing (statusCode, reason, and optional Throwable cause).

callback:Callback

the callback to track close frame sent (or failed).

demandback to summary
public 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).
flushback to summary
public void flush(Callback callback)
getBehaviorback to summary
public Behavior getBehavior()
Returns:Behavior

Client or Server behaviour

getByteBufferPoolback to summary
public ByteBufferPool getByteBufferPool()
Returns:ByteBufferPool

The shared ByteBufferPool

getLocalAddressback to summary
public SocketAddress getLocalAddress()

The Local Socket Address for the connection

Do 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 supporting InetSocketAddress

Returns:SocketAddress

the SocketAddress for the local connection, or null if not supported by Session

getNegotiatedExtensionsback to summary
public List<ExtensionConfig> getNegotiatedExtensions()

The negotiated WebSocket Extension Configurations for this session.

Returns:List<ExtensionConfig>

the list of Negotiated Extension Configurations for this session.

getNegotiatedSubProtocolback to summary
public String getNegotiatedSubProtocol()
getParameterMapback to summary
public Map<String, List<String>> getParameterMap()

The parameter map (from URI Query) for the active session.

Returns:Map<String, List<String>>

the immutable map of parameters

getProtocolVersionback to summary
public String getProtocolVersion()

The active Sec-WebSocket-Version (protocol version) in use.

Returns:String

the protocol version in use.

getRemoteAddressback to summary
public SocketAddress getRemoteAddress()

The Remote Socket Address for the connection

Do 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 supporting InetSocketAddress

Returns:SocketAddress

the SocketAddress for the remote connection, or null if not supported by Session

getRequestURIback to summary
public 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:URI

the absolute URI (including Query string)

getWebSocketComponentsback to summary
public WebSocketComponents getWebSocketComponents()
Returns:WebSocketComponents

the WebSocketComponents instance in use for this Connection.

isClosedback to summary
public boolean isClosed()
isInputOpenback to summary
public boolean isInputOpen()
Returns:boolean

True if the websocket is open inbound

isOutputOpenback to summary
public boolean isOutputOpen()
Returns:boolean

True if the websocket is open outbound

isRsv1Usedback to summary
public boolean isRsv1Used()
Returns:boolean

true if an extension has been negotiated which uses the RSV1 bit.

isRsv2Usedback to summary
public boolean isRsv2Used()
Returns:boolean

true if an extension has been negotiated which uses the RSV2 bit.

isRsv3Usedback to summary
public boolean isRsv3Used()
Returns:boolean

true if an extension has been negotiated which uses the RSV3 bit.

isSecureback to summary
public boolean isSecure()

The active connection's Secure status indicator.

Returns:boolean

true if connection is secure (similar in role to HttpServletRequest.isSecure())

org.eclipse.jetty.websocket.core back to summary

public Class CoreSession.Empty

extends ConfigurationCustomizer
implements CoreSession
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.websocket.core.CoreSession, org.eclipse.jetty.websocket.core.Configuration, org.eclipse.jetty.websocket.core.IncomingFrames, org.eclipse.jetty.websocket.core.OutgoingFrames

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
abort()

Implements org.eclipse.jetty.websocket.core.CoreSession.abort.

Issue a harsh abort of the underlying connection.

public void
close(Callback
the callback to track close frame sent (or failed).
callback
)

Implements org.eclipse.jetty.websocket.core.CoreSession.close.

Initiate close handshake, no payload (no declared status code or reason phrase).

public void
close(int
the status code (should be a valid status code that can be sent).
statusCode
,
String
optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol).
reason
,
Callback
the callback to track close frame sent (or failed).
callback
)

Implements org.eclipse.jetty.websocket.core.CoreSession.close.

Initiate close handshake with provided status code and optional reason phrase.

public void
close(CloseStatus
the close status containing (statusCode, reason, and optional Throwable cause).
closeStatus
,
Callback
the callback to track close frame sent (or failed).
callback
)

Overrides default org.eclipse.jetty.websocket.core.CoreSession.close.

Initiate close handshake with a provided CloseStatus.

public void
demand()

Implements org.eclipse.jetty.websocket.core.CoreSession.demand.

Manages flow control by indicating demand for a WebSocket frame.

public void
public Behavior
public ByteBufferPool
public SocketAddress
getLocalAddress()

Implements org.eclipse.jetty.websocket.core.CoreSession.getLocalAddress.

The Local Socket Address for the connection

Do not assume that this will return a InetSocketAddress in all cases.

public List<ExtensionConfig>
getNegotiatedExtensions()

Implements org.eclipse.jetty.websocket.core.CoreSession.getNegotiatedExtensions.

The negotiated WebSocket Extension Configurations for this session.

public String
public Map<String, List<String>>
getParameterMap()

Implements org.eclipse.jetty.websocket.core.CoreSession.getParameterMap.

The parameter map (from URI Query) for the active session.

public String
getProtocolVersion()

Implements org.eclipse.jetty.websocket.core.CoreSession.getProtocolVersion.

The active Sec-WebSocket-Version (protocol version) in use.

public SocketAddress
getRemoteAddress()

Implements org.eclipse.jetty.websocket.core.CoreSession.getRemoteAddress.

The Remote Socket Address for the connection

Do not assume that this will return a InetSocketAddress in all cases.

public URI
getRequestURI()

Implements org.eclipse.jetty.websocket.core.CoreSession.getRequestURI.

The active connection's Request URI.

public WebSocketComponents
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
isSecure()

Implements org.eclipse.jetty.websocket.core.CoreSession.isSecure.

The active connection's Secure status indicator.

public void
onFrame(Frame
the frame to process.
frame
,
Callback
the read completion.
callback
)

Implements org.eclipse.jetty.websocket.core.IncomingFrames.onFrame.

Process the incoming frame.

public void
sendFrame(Frame
the frame to eventually write to the network layer.
frame
,
Callback
the callback to notify when the frame is written.
callback
,
boolean
the batch mode requested by the sender.
batch
)

Implements org.eclipse.jetty.websocket.core.OutgoingFrames.sendFrame.

A frame, and optional callback, intended for the network layer.

Inherited from org.eclipse.jetty.websocket.core.Configuration.ConfigurationCustomizer:
customizegetIdleTimeoutgetInputBufferSizegetMaxBinaryMessageSizegetMaxFrameSizegetMaxOutgoingFramesgetMaxTextMessageSizegetOutputBufferSizegetWriteTimeoutisAutoFragmentsetAutoFragmentsetIdleTimeoutsetInputBufferSizesetMaxBinaryMessageSizesetMaxFrameSizesetMaxOutgoingFramessetMaxTextMessageSizesetOutputBufferSizesetWriteTimeouttoString

Constructor Detail

Emptyback to summary
public Empty()

Method Detail

abortback to summary
public void abort()

Implements org.eclipse.jetty.websocket.core.CoreSession.abort.

Doc from org.eclipse.jetty.websocket.core.CoreSession.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.

Annotations
@Override
closeback to summary
public void close(Callback callback)

Implements org.eclipse.jetty.websocket.core.CoreSession.close.

Doc from org.eclipse.jetty.websocket.core.CoreSession.close.

Initiate close handshake, no payload (no declared status code or reason phrase).

Parameters
callback:Callback

the callback to track close frame sent (or failed).

Annotations
@Override
closeback to summary
public void close(int statusCode, String reason, Callback callback)

Implements org.eclipse.jetty.websocket.core.CoreSession.close.

Doc from org.eclipse.jetty.websocket.core.CoreSession.close.

Initiate close handshake with provided status code and optional reason phrase.

Parameters
statusCode:int

the status code (should be a valid status code that can be sent).

reason:String

optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol).

callback:Callback

the callback to track close frame sent (or failed).

Annotations
@Override
closeback to summary
public void close(CloseStatus closeStatus, Callback callback)

Overrides default org.eclipse.jetty.websocket.core.CoreSession.close.

Doc from org.eclipse.jetty.websocket.core.CoreSession.close.

Initiate close handshake with a provided CloseStatus.

Parameters
closeStatus:CloseStatus

the close status containing (statusCode, reason, and optional Throwable cause).

callback:Callback

the callback to track close frame sent (or failed).

Annotations
@Override
demandback to summary
public void demand()

Implements org.eclipse.jetty.websocket.core.CoreSession.demand.

Doc from org.eclipse.jetty.websocket.core.CoreSession.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).
Annotations
@Override
flushback to summary
public void flush(Callback callback)

Implements org.eclipse.jetty.websocket.core.CoreSession.flush.

Annotations
@Override
getBehaviorback to summary
public Behavior getBehavior()

Implements org.eclipse.jetty.websocket.core.CoreSession.getBehavior.

Returns:Behavior

Doc from org.eclipse.jetty.websocket.core.CoreSession.getBehavior.

Client or Server behaviour

Annotations
@Override
getByteBufferPoolback to summary
public ByteBufferPool getByteBufferPool()

Implements org.eclipse.jetty.websocket.core.CoreSession.getByteBufferPool.

Returns:ByteBufferPool

Doc from org.eclipse.jetty.websocket.core.CoreSession.getByteBufferPool.

The shared ByteBufferPool

Annotations
@Override
getLocalAddressback to summary
public SocketAddress getLocalAddress()

Implements org.eclipse.jetty.websocket.core.CoreSession.getLocalAddress.

Doc from org.eclipse.jetty.websocket.core.CoreSession.getLocalAddress.

The Local Socket Address for the connection

Do 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 supporting InetSocketAddress

Returns:SocketAddress

the SocketAddress for the local connection, or null if not supported by Session

Annotations
@Override
getNegotiatedExtensionsback to summary
public List<ExtensionConfig> getNegotiatedExtensions()

Implements org.eclipse.jetty.websocket.core.CoreSession.getNegotiatedExtensions.

Doc from org.eclipse.jetty.websocket.core.CoreSession.getNegotiatedExtensions.

The negotiated WebSocket Extension Configurations for this session.

Returns:List<ExtensionConfig>

the list of Negotiated Extension Configurations for this session.

Annotations
@Override
getNegotiatedSubProtocolback to summary
public String getNegotiatedSubProtocol()

Implements org.eclipse.jetty.websocket.core.CoreSession.getNegotiatedSubProtocol.

Annotations
@Override
getParameterMapback to summary
public Map<String, List<String>> getParameterMap()

Implements org.eclipse.jetty.websocket.core.CoreSession.getParameterMap.

Doc from org.eclipse.jetty.websocket.core.CoreSession.getParameterMap.

The parameter map (from URI Query) for the active session.

Returns:Map<String, List<String>>

the immutable map of parameters

Annotations
@Override
getProtocolVersionback to summary
public String getProtocolVersion()

Implements org.eclipse.jetty.websocket.core.CoreSession.getProtocolVersion.

Doc from org.eclipse.jetty.websocket.core.CoreSession.getProtocolVersion.

The active Sec-WebSocket-Version (protocol version) in use.

Returns:String

the protocol version in use.

Annotations
@Override
getRemoteAddressback to summary
public SocketAddress getRemoteAddress()

Implements org.eclipse.jetty.websocket.core.CoreSession.getRemoteAddress.

Doc from org.eclipse.jetty.websocket.core.CoreSession.getRemoteAddress.

The Remote Socket Address for the connection

Do 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 supporting InetSocketAddress

Returns:SocketAddress

the SocketAddress for the remote connection, or null if not supported by Session

Annotations
@Override
getRequestURIback to summary
public URI getRequestURI()

Implements org.eclipse.jetty.websocket.core.CoreSession.getRequestURI.

Doc from org.eclipse.jetty.websocket.core.CoreSession.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:URI

the absolute URI (including Query string)

Annotations
@Override
getWebSocketComponentsback to summary
public WebSocketComponents getWebSocketComponents()

Implements org.eclipse.jetty.websocket.core.CoreSession.getWebSocketComponents.

Returns:WebSocketComponents

Doc from org.eclipse.jetty.websocket.core.CoreSession.getWebSocketComponents.

the WebSocketComponents instance in use for this Connection.

Annotations
@Override
isClosedback to summary
public boolean isClosed()

Implements org.eclipse.jetty.websocket.core.CoreSession.isClosed.

Annotations
@Override
isInputOpenback to summary
public boolean isInputOpen()

Implements org.eclipse.jetty.websocket.core.CoreSession.isInputOpen.

Returns:boolean

Doc from org.eclipse.jetty.websocket.core.CoreSession.isInputOpen.

True if the websocket is open inbound

Annotations
@Override
isOutputOpenback to summary
public boolean isOutputOpen()

Implements org.eclipse.jetty.websocket.core.CoreSession.isOutputOpen.

Returns:boolean

Doc from org.eclipse.jetty.websocket.core.CoreSession.isOutputOpen.

True if the websocket is open outbound

Annotations
@Override
isRsv1Usedback to summary
public boolean isRsv1Used()

Implements org.eclipse.jetty.websocket.core.CoreSession.isRsv1Used.

Returns:boolean

Doc from org.eclipse.jetty.websocket.core.CoreSession.isRsv1Used.

true if an extension has been negotiated which uses the RSV1 bit.

Annotations
@Override
isRsv2Usedback to summary
public boolean isRsv2Used()

Implements org.eclipse.jetty.websocket.core.CoreSession.isRsv2Used.

Returns:boolean

Doc from org.eclipse.jetty.websocket.core.CoreSession.isRsv2Used.

true if an extension has been negotiated which uses the RSV2 bit.

Annotations
@Override
isRsv3Usedback to summary
public boolean isRsv3Used()

Implements org.eclipse.jetty.websocket.core.CoreSession.isRsv3Used.

Returns:boolean

Doc from org.eclipse.jetty.websocket.core.CoreSession.isRsv3Used.

true if an extension has been negotiated which uses the RSV3 bit.

Annotations
@Override
isSecureback to summary
public boolean isSecure()

Implements org.eclipse.jetty.websocket.core.CoreSession.isSecure.

Doc from org.eclipse.jetty.websocket.core.CoreSession.isSecure.

The active connection's Secure status indicator.

Returns:boolean

true if connection is secure (similar in role to HttpServletRequest.isSecure())

Annotations
@Override
onFrameback to summary
public void onFrame(Frame frame, Callback callback)

Implements org.eclipse.jetty.websocket.core.IncomingFrames.onFrame.

Doc from org.eclipse.jetty.websocket.core.IncomingFrames.onFrame.

Process the incoming frame.

Note

if you need to hang onto any information from the frame, be sure to copy it, as the information contained in the Frame will be released and/or reused by the implementation.

Failure of the callback will propagate the failure back to the CoreSession to fail the connection and attempt to send a close Frame if one has not been sent.

Parameters
frame:Frame

the frame to process.

callback:Callback

the read completion.

Annotations
@Override
sendFrameback to summary
public void sendFrame(Frame frame, Callback callback, boolean batch)

Implements org.eclipse.jetty.websocket.core.OutgoingFrames.sendFrame.

Doc from org.eclipse.jetty.websocket.core.OutgoingFrames.sendFrame.

A frame, and optional callback, intended for the network layer.

Note

the frame can undergo many transformations in the various layers and extensions present in the implementation.

If you are implementing a mutation, you are obliged to handle the incoming Callback appropriately.

Parameters
frame:Frame

the frame to eventually write to the network layer.

callback:Callback

the callback to notify when the frame is written.

batch:boolean

the batch mode requested by the sender.

Annotations
@Override