|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.websocket.WsOutbound
public class WsOutbound
Provides the means to write WebSocket messages to the client. All methods that write to the client (or update a buffer that is later written to the client) are synchronized to prevent multiple threads trying to write to the client at the same time.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
|
Constructor Summary | |
---|---|
WsOutbound(UpgradeOutbound upgradeOutbound)
|
|
WsOutbound(UpgradeOutbound upgradeOutbound,
int byteBufferSize,
int charBufferSize)
|
Method Summary | |
---|---|
void |
close(int status,
ByteBuffer data)
Send a close message to the client |
protected void |
close(WsFrame frame)
Respond to a client close by sending a close that echoes the status code and message. |
void |
flush()
Flush any message (binary or textual) that may be buffered. |
void |
pong(ByteBuffer data)
Send a pong message to the client |
void |
writeBinaryData(int b)
Adds the data to the buffer for binary data. |
void |
writeBinaryMessage(ByteBuffer msgBb)
Flush any message (binary or textual) that may be buffered and then send a WebSocket binary message as a single frame with the provided buffer as the payload of the message. |
void |
writeTextData(char c)
Adds the data to the buffer for textual data. |
void |
writeTextMessage(CharBuffer msgCb)
Flush any message (binary or textual) that may be buffered and then send a WebSocket text message as a single frame with the provided buffer as the payload of the message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public WsOutbound(UpgradeOutbound upgradeOutbound)
public WsOutbound(UpgradeOutbound upgradeOutbound, int byteBufferSize, int charBufferSize)
Method Detail |
---|
public void writeBinaryData(int b) throws IOException
b
- The byte (only the least significant byte is used) of data to
send to the client.
IOException
- If a flush is required and an error occurs writing
the WebSocket frame to the clientpublic void writeTextData(char c) throws IOException
c
- The character to send to the client.
IOException
- If a flush is required and an error occurs writing
the WebSocket frame to the clientpublic void writeBinaryMessage(ByteBuffer msgBb) throws IOException
msgBb
- The buffer containing the payload
IOException
- If an error occurs writing to the clientpublic void writeTextMessage(CharBuffer msgCb) throws IOException
msgCb
- The buffer containing the payload
IOException
- If an error occurs writing to the clientpublic void flush() throws IOException
IOException
- If an error occurs writing to the clientprotected void close(WsFrame frame) throws IOException
frame
- The close frame received from a client
IOException
- If an error occurs writing to the clientpublic void close(int status, ByteBuffer data) throws IOException
status
- Must be a valid status code or zero to send no codedata
- Optional message. If message is defined, a valid status
code must be provided.
IOException
- If an error occurs writing to the clientpublic void pong(ByteBuffer data) throws IOException
data
- Optional message.
IOException
- If an error occurs writing to the client
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |