public class WebSocketBareClient extends java.lang.Object implements WebSocketContext, WebSocketConstants
CLOSE_ERROR, CLOSE_MESSAGE_TOO_BIG, CLOSE_OK, CLOSE_UTF8, FLAG_FIN, FLAG_MASK, MASK_OPCODE, OP_BINARY, OP_CLOSE, OP_CONT, OP_PING, OP_PONG, OP_TEXT, VERSION| Constructor and Description |
|---|
WebSocketBareClient(java.lang.String address,
int port,
int extensionId,
WebSocketEndpoint endpoint) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
gracefully close the connection, waiting for unread messages.
|
void |
close(int code,
java.lang.String msg)
gracefully close the connection, waiting for unread messages.
|
void |
connect() |
void |
connect(java.lang.String userName,
java.lang.String password) |
protected void |
connectImpl(java.lang.String userName,
java.lang.String password) |
<T> java.util.concurrent.BlockingQueue<T> |
createOutputQueue(WebSocketEncoder<T> encoder)
Creates a thread-safe queue, which applications can send objects to be
marshaled.
|
void |
disconnect()
Disconnect the connection.
|
void |
flush()
flushes the output stream
|
java.io.InputStream |
getInputStream() |
protected java.lang.String |
getProtocolHeader() |
long |
getTimeout()
Gets the read timeout.
|
boolean |
isAutoFlush()
returns the current flush mode.
|
boolean |
isClosed() |
void |
onClose(int closeCode,
java.lang.String closeMessage) |
void |
pong(byte[] message)
sends a pong message
|
void |
setAutoFlush(boolean isAutoFlush)
auto-flush after each message is sent.
|
void |
setConnectTimeout(long timeout) |
void |
setEndpoint(WebSocketEndpoint endpoint) |
void |
setProtocolHeader(java.lang.String header) |
void |
setTimeout(long timeout)
Sets the read timeout.
|
java.io.OutputStream |
startBinaryMessage()
Returns the output stream for a binary message.
|
java.io.PrintWriter |
startTextMessage()
Returns the output stream for a binary message.
|
java.lang.String |
toString() |
public WebSocketBareClient(java.lang.String address,
int port,
int extensionId,
WebSocketEndpoint endpoint)
public void setConnectTimeout(long timeout)
public void setProtocolHeader(java.lang.String header)
public void setEndpoint(WebSocketEndpoint endpoint)
protected java.lang.String getProtocolHeader()
public void connect()
throws java.io.IOException
java.io.IOExceptionpublic void connect(java.lang.String userName,
java.lang.String password)
throws java.io.IOException
java.io.IOExceptionprotected void connectImpl(java.lang.String userName,
java.lang.String password)
throws java.io.IOException
java.io.IOExceptionpublic void disconnect()
WebSocketContextdisconnect in interface WebSocketContextpublic <T> java.util.concurrent.BlockingQueue<T> createOutputQueue(WebSocketEncoder<T> encoder)
WebSocketContextcreateOutputQueue in interface WebSocketContextpublic void setAutoFlush(boolean isAutoFlush)
WebSocketContextsetAutoFlush in interface WebSocketContextpublic boolean isAutoFlush()
WebSocketContextisAutoFlush in interface WebSocketContextpublic void flush()
throws java.io.IOException
WebSocketContextflush in interface WebSocketContextjava.io.IOExceptionpublic boolean isClosed()
public void close()
WebSocketContextclose in interface WebSocketContextpublic void close(int code,
java.lang.String msg)
WebSocketContextclose in interface WebSocketContextpublic java.io.InputStream getInputStream()
public java.io.OutputStream startBinaryMessage()
throws java.io.IOException
WebSocketContextstartBinaryMessage in interface WebSocketContextjava.io.IOExceptionpublic java.io.PrintWriter startTextMessage()
WebSocketContextstartTextMessage in interface WebSocketContextpublic long getTimeout()
WebSocketContextgetTimeout in interface WebSocketContextpublic void setTimeout(long timeout)
WebSocketContextsetTimeout in interface WebSocketContextpublic void pong(byte[] message)
throws java.io.IOException
WebSocketContextpong in interface WebSocketContextjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void onClose(int closeCode,
java.lang.String closeMessage)
onClose in interface WebSocketContext