public interface WebSocketConnection
Modifier and Type | Method and Description |
---|---|
void |
close()
Send a websocket Close frame, without a status code or reason.
|
void |
close(int statusCode,
String reason)
Send a websocket Close frame, with status code.
|
InetSocketAddress |
getLocalAddress()
Get the address of the local side.
|
WebSocketPolicy |
getPolicy()
Access the (now read-only)
WebSocketPolicy in use for this connection. |
InetSocketAddress |
getRemoteAddress()
Get the address of the remote side.
|
URI |
getRequestURI()
Get the Request URI
|
String |
getSubProtocol()
Get the SubProtocol in use for this connection.
|
boolean |
isOpen()
Is the connection open.
|
void |
ping(ByteBuffer buf)
Send a single ping messages.
|
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
Future<Void> |
write(byte[] buf,
int offset,
int len)
Send an async binary message.
|
Future<Void> |
write(ByteBuffer buffer)
Send an async binary message.
|
Future<Void> |
write(String message)
Send an async text messages.
|
void close() throws IOException
Basic usage: results in an non-blocking async write, then connection close.
IOException
StatusCode
,
close(int, String)
void close(int statusCode, String reason) throws IOException
Advanced usage: results in an non-blocking async write, then connection close.
statusCode
- the status codereason
- the (optional) reason. (can be null for no reason)IOException
StatusCode
InetSocketAddress getLocalAddress()
WebSocketPolicy getPolicy()
WebSocketPolicy
in use for this connection.InetSocketAddress getRemoteAddress()
URI getRequestURI()
String getSubProtocol()
boolean isOpen()
void ping(ByteBuffer buf) throws IOException
NIO style with callbacks, allows for knowledge of successful ping send.
Use @OnWebSocketFrame and monitor Pong frames
the
- ping application dataIOException
SuspendToken suspend()
Future<Void> write(ByteBuffer buffer)
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.