public abstract class AbstractWebSocketConnection extends AbstractConnection implements LogicalConnection, Connection.UpgradeTo, Dumpable
LogicalConnection within the framework of the new Connection framework of jetty-io.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractWebSocketConnection.Stats
Deprecated.
|
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo| Constructor and Description |
|---|
AbstractWebSocketConnection(EndPoint endp,
Executor executor,
Scheduler scheduler,
WebSocketPolicy policy,
ByteBufferPool bufferPool) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReadWebSocketFrames()
Test if Connection State allows for reading of frames.
|
boolean |
canWriteWebSocketFrames()
Test if Connection State allows for writing frames.
|
void |
close()
Jetty Connection Close
|
void |
close(CloseInfo close,
Callback callback)
Request a local close.
|
void |
close(Throwable cause)
Close the connection based on the throwable
|
void |
disconnect()
Terminate the connection (no close frame sent)
|
void |
dump(Appendable out,
String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
String |
dumpSelf()
The description of this/self found in the dump.
|
void |
fillInterested()
Utility method to be called to register read interest.
|
ByteBufferPool |
getBufferPool()
Get the ByteBufferPool in use by the connection
|
long |
getBytesIn() |
long |
getBytesOut() |
Executor |
getExecutor()
Get the Executor used by this connection.
|
List<ExtensionConfig> |
getExtensions()
Get the list of extensions in use.
|
Generator |
getGenerator() |
String |
getId()
Get Unique ID for the Connection
|
long |
getIdleTimeout()
Get the read/write idle timeout.
|
InetSocketAddress |
getLocalAddress()
Get the local
InetSocketAddress in use for this connection. |
long |
getMaxIdleTimeout()
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)
|
long |
getMessagesIn() |
long |
getMessagesOut() |
Parser |
getParser() |
WebSocketPolicy |
getPolicy()
The policy that the connection is running under.
|
InetSocketAddress |
getRemoteAddress()
Get the remote Address in use for this connection.
|
Scheduler |
getScheduler() |
AbstractWebSocketConnection.Stats |
getStats()
Deprecated.
|
boolean |
isOpen()
Test if logical connection is still open
|
boolean |
isReading()
Tests if the connection is actively reading.
|
void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
boolean |
onIdleExpired()
Callback method invoked upon an idle timeout event.
|
void |
onUpgradeTo(ByteBuffer prefilled)
Extra bytes from the initial HTTP upgrade that need to
be processed by the websocket parser before starting
to read bytes from the connection
|
boolean |
opened()
Set the state to opened (the application onOpen() method has been called successfully).
|
boolean |
opening()
Set the state to upgrade/opening handshake has completed.
|
void |
outgoingFrame(Frame frame,
WriteCallback callback,
BatchMode batchMode)
Frame from API, User, or Internal implementation destined for network.
|
void |
remoteClose(CloseInfo close)
Report that the Remote Endpoint CLOSE Frame has been received
|
void |
resume()
Resume a previously suspended connection.
|
void |
setExtensions(List<ExtensionConfig> extensions)
Get the list of extensions in use.
|
void |
setInputBufferSize(int inputBufferSize) |
void |
setMaxIdleTimeout(long ms)
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)
|
void |
setNextIncomingFrames(IncomingFrames incoming)
Set where the connection should send the incoming frames to.
|
void |
setSession(WebSocketSession session)
Associate the Active Session with the connection.
|
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
String |
toConnectionString() |
String |
toStateString()
Get the Connection State as a String
|
addListener, getCreatedTimeStamp, getEndPoint, getInputBufferSize, isFillInterested, onClose, onOpen, removeListener, toString, tryFillInterested, tryFillInterestedequals, getClass, hashCode, notify, notifyAll, wait, wait, waitdump, dump, dumpContainer, dumpIterable, dumpMapEntries, dumpObject, dumpObjects, namedpublic AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool)
public Executor getExecutor()
LogicalConnectiongetExecutor in interface LogicalConnectionpublic void close(CloseInfo close, Callback callback)
LogicalConnectionclose in interface LogicalConnectionpublic void close(Throwable cause)
close in interface LogicalConnectioncause - the causepublic boolean canWriteWebSocketFrames()
LogicalConnectioncanWriteWebSocketFrames in interface LogicalConnectionpublic boolean canReadWebSocketFrames()
LogicalConnectioncanReadWebSocketFrames in interface LogicalConnectionpublic String toStateString()
LogicalConnectiontoStateString in interface LogicalConnectionpublic boolean opening()
LogicalConnectionopening in interface LogicalConnectionpublic boolean opened()
LogicalConnectionReads from network begin here.
opened in interface LogicalConnectionpublic void remoteClose(CloseInfo close)
LogicalConnectionremoteClose in interface LogicalConnectionclose - the close frame detailspublic void setSession(WebSocketSession session)
LogicalConnectionsetSession in interface LogicalConnectionsession - the session for this connectionpublic boolean onIdleExpired()
ConnectionCallback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
onIdleExpired in interface ConnectiononIdleExpired in class AbstractConnectionpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface Connectionclose in class AbstractConnectionpublic void disconnect()
LogicalConnectiondisconnect in interface LogicalConnectionpublic void fillInterested()
AbstractConnectionUtility method to be called to register read interest.
After a call to this method, AbstractConnection.onFillable() or AbstractConnection.onFillInterestedFailed(Throwable)
will be called back as appropriate.
fillInterested in class AbstractConnectionAbstractConnection.onFillable()public ByteBufferPool getBufferPool()
LogicalConnectiongetBufferPool in interface LogicalConnectionpublic List<ExtensionConfig> getExtensions()
This list is negotiated during the WebSocket Upgrade Request/Response handshake.
public Generator getGenerator()
public String getId()
LogicalConnectiongetId in interface LogicalConnectionpublic long getIdleTimeout()
LogicalConnectiongetIdleTimeout in interface LogicalConnectionpublic long getMaxIdleTimeout()
LogicalConnectiongetMaxIdleTimeout in interface LogicalConnectionpublic Parser getParser()
public WebSocketPolicy getPolicy()
LogicalConnectiongetPolicy in interface LogicalConnectionpublic InetSocketAddress getLocalAddress()
LogicalConnectionInetSocketAddress in use for this connection.
Note: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
getLocalAddress in interface LogicalConnectionpublic InetSocketAddress getRemoteAddress()
LogicalConnectionNote: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
getRemoteAddress in interface LogicalConnectionpublic Scheduler getScheduler()
@Deprecated public AbstractWebSocketConnection.Stats getStats()
public boolean isOpen()
LogicalConnectionisOpen in interface LogicalConnectionpublic boolean isReading()
LogicalConnectionisReading in interface LogicalConnectionpublic void onFillable()
AbstractConnectionCallback method invoked when the endpoint is ready to be read.
onFillable in class AbstractConnectionAbstractConnection.fillInterested()public void resume()
SuspendTokenresume in interface SuspendTokenpublic SuspendToken suspend()
LogicalConnectionsuspend in interface LogicalConnectionpublic void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
outgoingFrame in interface OutgoingFramesframe - the frame to eventually write to the network layer.callback - the callback to notify when the frame is written.batchMode - the batch mode requested by the sender.public void setExtensions(List<ExtensionConfig> extensions)
This list is negotiated during the WebSocket Upgrade Request/Response handshake.
extensions - the list of negotiated extensions in use.public void setInputBufferSize(int inputBufferSize)
setInputBufferSize in class AbstractConnectionpublic void setMaxIdleTimeout(long ms)
LogicalConnectionThis idle timeout cannot be garunteed to take immediate effect for any active read/write actions. New read/write actions will have this new idle timeout.
setMaxIdleTimeout in interface LogicalConnectionms - the number of milliseconds of idle timeoutpublic String dumpSelf()
Dumpablepublic void dump(Appendable out, String indent) throws IOException
Dumpabledump in interface Dumpableout - The appendable to dump toindent - The indent to apply after any new lines.IOException - if unable to write to Appendablepublic String toConnectionString()
toConnectionString in class AbstractConnectionpublic void onUpgradeTo(ByteBuffer prefilled)
onUpgradeTo in interface Connection.UpgradeToprefilled - An optional buffer that can contain prefilled data. Typically this
results from an upgrade of one protocol to the other where the old connection has buffered
data destined for the new connection. The new connection must take ownership of the buffer
and is responsible for returning it to the buffer poolpublic void setNextIncomingFrames(IncomingFrames incoming)
LogicalConnectionOften this is from the Parser to the start of the extension stack, and eventually on to the session.
setNextIncomingFrames in interface LogicalConnectionincoming - the incoming frames handlerpublic long getMessagesIn()
getMessagesIn in interface ConnectiongetMessagesIn in class AbstractConnectionpublic long getMessagesOut()
getMessagesOut in interface ConnectiongetMessagesOut in class AbstractConnectionpublic long getBytesIn()
getBytesIn in interface ConnectiongetBytesIn in class AbstractConnectionpublic long getBytesOut()
getBytesOut in interface ConnectiongetBytesOut in class AbstractConnectionCopyright © 2010 - 2020 Adobe. All Rights Reserved