public interface Session extends Closeable
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()
Issue a harsh disconnect of the underlying connection.
|
long |
getIdleTimeout()
Return the number of milliseconds before this conversation will be closed by the container if it is inactive, ie no messages are either sent or received
in that time.
|
InetSocketAddress |
getLocalAddress()
Get the address of the local side.
|
long |
getMaximumMessageSize()
The maximum total length of messages, text or binary, that this Session can handle.
|
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.
|
UpgradeRequest |
getUpgradeRequest()
Get the UpgradeRequest used to create this session
|
UpgradeResponse |
getUpgradeResponse()
Get the UpgradeResponse used to create this session
|
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 |
setIdleTimeout(long ms)
Set the number of milliseconds before this conversation will be closed by the container if it is inactive, ie no messages are either sent or received.
|
void |
setMaximumMessageSize(long length)
Sets the maximum total length of messages, text or binary, that this Session can handle.
|
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
void close() throws IOException
This will enqueue a graceful close to the remote endpoint.
close
in interface AutoCloseable
close
in interface Closeable
IOException
close(CloseStatus)
,
close(int, String)
,
disconnect()
void close(CloseStatus closeStatus) throws IOException
This will enqueue a graceful close to the remote endpoint.
closeStatus
- the reason for the closureIOException
close()
,
close(int, String)
,
disconnect()
void close(int statusCode, String reason) throws IOException
This will enqueue a graceful close to the remote endpoint.
statusCode
- the status codereason
- the (optional) reason. (can be null for no reason)IOException
StatusCode
,
close()
,
close(CloseStatus)
,
disconnect()
void disconnect() throws IOException
This will terminate the connection, without sending a websocket close frame.
Once called, any read/write activity on the websocket from this point will be indeterminate.
Once the underlying connection has been determined to be closed, the various onClose() events (either
WebSocketListener.onWebSocketClose(int, String)
or OnWebSocketClose
) will be called on your websocket.
IOException
close()
,
close(CloseStatus)
,
close(int, String)
,
disconnect()
long getIdleTimeout()
InetSocketAddress getLocalAddress()
long getMaximumMessageSize()
WebSocketPolicy getPolicy()
WebSocketPolicy
in use for this connection.String getProtocolVersion()
RemoteEndpoint getRemote()
InetSocketAddress getRemoteAddress()
UpgradeRequest getUpgradeRequest()
UpgradeResponse getUpgradeResponse()
boolean isOpen()
boolean isSecure()
void setIdleTimeout(long ms)
ms
- the number of milliseconds.void setMaximumMessageSize(long length)
SuspendToken suspend()
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.