public abstract class AbstractWebSocketConnection extends AbstractConnection implements BaseConnection, BaseConnection.SuspendToken, OutgoingFrames
WebSocketConnection
within the framework of the new Connection
framework of jetty-ioBaseConnection.State, BaseConnection.SuspendToken
Connection.Listener
Constructor and Description |
---|
AbstractWebSocketConnection(EndPoint endp,
Executor executor,
Scheduler scheduler,
WebSocketPolicy policy,
ByteBufferPool bufferPool) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Performs a logical close of this connection.
|
void |
close(int statusCode,
String reason)
Send a websocket Close frame, with status code.
|
<C> void |
complete(FrameBytes<C> frameBytes) |
void |
disconnect()
Terminate the connection (no close frame sent)
|
void |
disconnect(boolean onlyOutput) |
void |
flush() |
ByteBufferPool |
getBufferPool() |
List<ExtensionConfig> |
getExtensions()
Get the list of extensions in use.
|
Generator |
getGenerator() |
Parser |
getParser() |
WebSocketPolicy |
getPolicy() |
FrameQueue |
getQueue() |
InetSocketAddress |
getRemoteAddress()
Get the remote Address in use for this connection.
|
Scheduler |
getScheduler() |
WebSocketSession |
getSession() |
BaseConnection.State |
getState()
Get the state of the connection.
|
boolean |
isOpen()
Simple test to see if connection is open (and not closed)
|
boolean |
isReading()
Tests if the connection is actively reading.
|
void |
notifyClosing()
Notify that the connection has entered the closing handshake
|
void |
onClose()
Callback method invoked when this
Connection is closed. |
void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
void |
onOpen()
Callback method invoked when this
Connection is opened. |
<C> void |
output(C context,
Callback<C> callback,
WebSocketFrame frame)
Enqueue internal frame from
OutgoingFrames stack for eventual write out on the physical connection. |
void |
resume()
Resume a previously suspended connection.
|
void |
setExtensions(List<ExtensionConfig> extensions)
Get the list of extensions in use.
|
void |
setSession(WebSocketSession session) |
BaseConnection.SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
String |
toString() |
addListener, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, onFillInterestedFailed, onReadTimeout, setInputBufferSize
public AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool)
public void close()
Connection
Performs a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPoint
but, for example, SSL connections should write the SSL close message
before closing the associated EndPoint
.
close
in interface AutoCloseable
close
in interface Connection
close
in interface BaseConnection
close
in class AbstractConnection
StatusCode
,
BaseConnection.close(int, String)
public void close(int statusCode, String reason)
BaseConnection
Advanced usage: results in an non-blocking async write, then connection close.
close
in interface BaseConnection
statusCode
- the status codereason
- the (optional) reason. (can be null for no reason)StatusCode
public <C> void complete(FrameBytes<C> frameBytes)
public void disconnect()
BaseConnection
disconnect
in interface BaseConnection
public void disconnect(boolean onlyOutput)
public void flush()
public ByteBufferPool getBufferPool()
public List<ExtensionConfig> getExtensions()
This list is negotiated during the WebSocket Upgrade Request/Response handshake.
public Generator getGenerator()
public Parser getParser()
public WebSocketPolicy getPolicy()
public FrameQueue getQueue()
public InetSocketAddress getRemoteAddress()
BaseConnection
getRemoteAddress
in interface BaseConnection
public Scheduler getScheduler()
public WebSocketSession getSession()
public BaseConnection.State getState()
BaseConnection
getState
in interface BaseConnection
public boolean isOpen()
BaseConnection
isOpen
in interface BaseConnection
public boolean isReading()
BaseConnection
isReading
in interface BaseConnection
public void notifyClosing()
BaseConnection
notifyClosing
in interface BaseConnection
public void onClose()
Connection
Callback method invoked when this Connection
is closed.
Creators of the connection implementation are responsible for calling this method.
onClose
in interface Connection
onClose
in class AbstractConnection
public void onFillable()
AbstractConnection
Callback method invoked when the endpoint is ready to be read.
onFillable
in class AbstractConnection
AbstractConnection.fillInterested()
public void onOpen()
Connection
Callback method invoked when this Connection
is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen
in interface Connection
onOpen
in class AbstractConnection
public <C> void output(C context, Callback<C> callback, WebSocketFrame frame)
OutgoingFrames
stack for eventual write out on the physical connection.output
in interface OutgoingFrames
public void resume()
BaseConnection.SuspendToken
resume
in interface BaseConnection.SuspendToken
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 setSession(WebSocketSession session)
public BaseConnection.SuspendToken suspend()
BaseConnection
suspend
in interface BaseConnection
public String toString()
toString
in class AbstractConnection
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.