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<javax.net.websocket.SendResult> |
write(byte[] buf,
int offset,
int len)
Send a a binary message.
|
Future<javax.net.websocket.SendResult> |
write(ByteBuffer buffer)
Send a a binary message.
|
Future<javax.net.websocket.SendResult> |
write(String message)
Send a series of 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<javax.net.websocket.SendResult> write(byte[] buf, int offset, int len) throws IOException
NIO style with callbacks, allows for concurrent results of the write operation.
IOException
Future<javax.net.websocket.SendResult> write(ByteBuffer buffer) throws IOException
NIO style with callbacks, allows for concurrent results of the write operation.
IOException
Future<javax.net.websocket.SendResult> write(String message) throws IOException
NIO style with callbacks, allows for concurrent results of the entire write operation. (Callback is only called once at the end of processing all of the messages)
IOException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.