@ManagedObject(value="A Jetty WebSocket Session") public class WebSocketSession extends ContainerLifeCycle implements Session, IncomingFrames, IOState.ConnectionStateListener
AbstractLifeCycle.AbstractLifeCycleListener
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Constructor and Description |
---|
WebSocketSession(URI requestURI,
EventDriver websocket,
LogicalConnection connection,
SessionListener... sessionListeners) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Request a close of the current conversation with a normal status code and no reason phrase.
|
void |
close(CloseStatus closeStatus)
Request Close the current conversation, giving a reason for the closure.
|
void |
close(int statusCode,
String reason)
Send a websocket Close frame, with status code.
|
void |
disconnect()
Harsh disconnect
|
void |
dispatch(Runnable runnable) |
void |
dump(Appendable out,
String indent) |
boolean |
equals(Object obj) |
BatchMode |
getBatchMode() |
ByteBufferPool |
getBufferPool() |
ClassLoader |
getClassLoader() |
LogicalConnection |
getConnection() |
ExtensionFactory |
getExtensionFactory() |
long |
getIdleTimeout()
The idle timeout in milliseconds
|
IncomingFrames |
getIncomingHandler() |
InetSocketAddress |
getLocalAddress()
Get the address of the local side.
|
OutgoingFrames |
getOutgoingHandler() |
WebSocketPolicy |
getPolicy()
Access the (now read-only)
WebSocketPolicy in use for this connection. |
String |
getProtocolVersion()
Returns the version of the websocket protocol currently being used.
|
RemoteEndpoint |
getRemote()
Return a reference to the RemoteEndpoint object representing the other end of this conversation.
|
InetSocketAddress |
getRemoteAddress()
Get the address of the remote side.
|
URI |
getRequestURI() |
UpgradeRequest |
getUpgradeRequest()
Get the UpgradeRequest used to create this session
|
UpgradeResponse |
getUpgradeResponse()
Get the UpgradeResponse used to create this session
|
int |
hashCode() |
void |
incomingError(Throwable t)
Incoming Errors from Parser
|
void |
incomingFrame(Frame frame)
Incoming Raw Frames from Parser
|
boolean |
isOpen()
Return true if and only if the underlying socket is open.
|
boolean |
isSecure()
Return true if and only if the underlying socket is using a secure transport.
|
void |
notifyClose(int statusCode,
String reason) |
void |
notifyError(Throwable cause) |
void |
onConnectionStateChange(ConnectionState state) |
void |
open()
Open/Activate the session
|
void |
setExtensionFactory(ExtensionFactory extensionFactory) |
void |
setIdleTimeout(long ms)
Set the timeout in milliseconds
|
void |
setOutgoingHandler(OutgoingFrames outgoing) |
void |
setPolicy(WebSocketPolicy policy) |
void |
setUpgradeRequest(UpgradeRequest request) |
void |
setUpgradeResponse(UpgradeResponse response) |
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public WebSocketSession(URI requestURI, EventDriver websocket, LogicalConnection connection, SessionListener... sessionListeners)
public void close()
Session
This will enqueue a graceful close to the remote endpoint.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Session
Session.close(CloseStatus)
,
Session.close(int, String)
,
Session.disconnect()
public void close(CloseStatus closeStatus)
Session
This will enqueue a graceful close to the remote endpoint.
close
in interface Session
closeStatus
- the reason for the closureSession.close()
,
Session.close(int, String)
,
Session.disconnect()
public void close(int statusCode, String reason)
Session
This will enqueue a graceful close to the remote endpoint.
close
in interface Session
statusCode
- the status codereason
- the (optional) reason. (can be null for no reason)StatusCode
,
Session.close()
,
Session.close(CloseStatus)
,
Session.disconnect()
public void disconnect()
disconnect
in interface Session
Session.close()
,
Session.close(CloseStatus)
,
Session.close(int, String)
,
Session.disconnect()
public void dispatch(Runnable runnable)
public void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class ContainerLifeCycle
IOException
public ByteBufferPool getBufferPool()
public ClassLoader getClassLoader()
public LogicalConnection getConnection()
public ExtensionFactory getExtensionFactory()
public long getIdleTimeout()
getIdleTimeout
in interface Session
@ManagedAttribute(readonly=true) public IncomingFrames getIncomingHandler()
public InetSocketAddress getLocalAddress()
Session
getLocalAddress
in interface Session
@ManagedAttribute(readonly=true) public OutgoingFrames getOutgoingHandler()
public WebSocketPolicy getPolicy()
Session
WebSocketPolicy
in use for this connection.public String getProtocolVersion()
Session
getProtocolVersion
in interface Session
public RemoteEndpoint getRemote()
Session
public InetSocketAddress getRemoteAddress()
Session
getRemoteAddress
in interface Session
public URI getRequestURI()
public UpgradeRequest getUpgradeRequest()
Session
getUpgradeRequest
in interface Session
public UpgradeResponse getUpgradeResponse()
Session
getUpgradeResponse
in interface Session
public void incomingError(Throwable t)
incomingError
in interface IncomingFrames
public void incomingFrame(Frame frame)
incomingFrame
in interface IncomingFrames
frame
- the frame to processpublic boolean isOpen()
Session
public boolean isSecure()
Session
public void notifyClose(int statusCode, String reason)
public void notifyError(Throwable cause)
public void onConnectionStateChange(ConnectionState state)
onConnectionStateChange
in interface IOState.ConnectionStateListener
public void open()
public void setExtensionFactory(ExtensionFactory extensionFactory)
public void setIdleTimeout(long ms)
setIdleTimeout
in interface Session
ms
- the number of milliseconds.public void setOutgoingHandler(OutgoingFrames outgoing)
public void setPolicy(WebSocketPolicy policy)
public void setUpgradeRequest(UpgradeRequest request)
public void setUpgradeResponse(UpgradeResponse response)
public SuspendToken suspend()
Session
public BatchMode getBatchMode()
Copyright © 1995-2015 Webtide. All Rights Reserved.