@ManagedObject(value="A Jetty WebSocket Session") public class WebSocketSession extends ContainerLifeCycle implements Session, RemoteEndpointFactory, WebSocketSessionScope, IncomingFrames, Connection.Listener, IOState.ConnectionStateListener
Modifier and Type | Class and Description |
---|---|
static interface |
WebSocketSession.Listener |
AbstractLifeCycle.AbstractLifeCycleListener
Connection.Listener.Adapter
Container.InheritedListener
Constructor and Description |
---|
WebSocketSession(WebSocketContainerScope containerScope,
URI requestURI,
EventDriver websocket,
LogicalConnection connection) |
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) |
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(Appendable out,
String indent) |
boolean |
equals(Object obj) |
BatchMode |
getBatchMode() |
ByteBufferPool |
getBufferPool() |
ClassLoader |
getClassLoader() |
LogicalConnection |
getConnection() |
WebSocketContainerScope |
getContainerScope()
The parent
WebSocketContainerScope for this session scope. |
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
|
WebSocketSession |
getWebSocketSession()
Active
WebSocketSession associated with this scope. |
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.
|
WebSocketRemoteEndpoint |
newRemoteEndpoint(LogicalConnection connection,
OutgoingFrames outgoingFrames,
BatchMode batchMode) |
void |
notifyClose(int statusCode,
String reason) |
void |
notifyError(Throwable cause) |
void |
onClosed(Connection connection) |
void |
onConnectionStateChange(ConnectionState state) |
void |
onOpened(Connection connection) |
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, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public WebSocketSession(WebSocketContainerScope containerScope, URI requestURI, EventDriver websocket, LogicalConnection connection)
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)
protected void doStart() throws Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
Exception
protected void doStop() throws Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
Exception
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 WebSocketContainerScope getContainerScope()
WebSocketSessionScope
WebSocketContainerScope
for this session scope.getContainerScope
in interface WebSocketSessionScope
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 WebSocketSession getWebSocketSession()
WebSocketSessionScope
WebSocketSession
associated with this scope.getWebSocketSession
in interface WebSocketSessionScope
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 onClosed(Connection connection)
onClosed
in interface Connection.Listener
public void onOpened(Connection connection)
onOpened
in interface Connection.Listener
public void onConnectionStateChange(ConnectionState state)
onConnectionStateChange
in interface IOState.ConnectionStateListener
public WebSocketRemoteEndpoint newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
newRemoteEndpoint
in interface RemoteEndpointFactory
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-2016 Webtide. All Rights Reserved.