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.IOException
public void connect(java.lang.String userName, java.lang.String password) throws java.io.IOException
java.io.IOException
protected void connectImpl(java.lang.String userName, java.lang.String password) throws java.io.IOException
java.io.IOException
public void disconnect()
WebSocketContext
disconnect
in interface WebSocketContext
public <T> java.util.concurrent.BlockingQueue<T> createOutputQueue(WebSocketEncoder<T> encoder)
WebSocketContext
createOutputQueue
in interface WebSocketContext
public void setAutoFlush(boolean isAutoFlush)
WebSocketContext
setAutoFlush
in interface WebSocketContext
public boolean isAutoFlush()
WebSocketContext
isAutoFlush
in interface WebSocketContext
public void flush() throws java.io.IOException
WebSocketContext
flush
in interface WebSocketContext
java.io.IOException
public boolean isClosed()
public void close()
WebSocketContext
close
in interface WebSocketContext
public void close(int code, java.lang.String msg)
WebSocketContext
close
in interface WebSocketContext
public java.io.InputStream getInputStream()
public java.io.OutputStream startBinaryMessage() throws java.io.IOException
WebSocketContext
startBinaryMessage
in interface WebSocketContext
java.io.IOException
public java.io.PrintWriter startTextMessage()
WebSocketContext
startTextMessage
in interface WebSocketContext
public long getTimeout()
WebSocketContext
getTimeout
in interface WebSocketContext
public void setTimeout(long timeout)
WebSocketContext
setTimeout
in interface WebSocketContext
public void pong(byte[] message) throws java.io.IOException
WebSocketContext
pong
in interface WebSocketContext
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void onClose(int closeCode, java.lang.String closeMessage)
onClose
in interface WebSocketContext