org.apache.catalina.websocket

## Class WsOutbound

- java.lang.Object
- - org.apache.catalina.websocket.WsOutbound

Deprecated.
Replaced by the JSR356 WebSocket 1.0 implementation and will be removed in Tomcat 8.0.x.

    @Deprecated
    public class WsOutbound
    extends Object

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

Fields
`static int` `DEFAULT_BUFFER_SIZE` Deprecated.

### Constructor Summary

Constructors
Constructor and Description
`WsOutbound(UpgradeOutbound upgradeOutbound, StreamInbound streamInbound)` Deprecated.
`WsOutbound(UpgradeOutbound upgradeOutbound, StreamInbound streamInbound, int byteBufferSize, int charBufferSize)` Deprecated.

### Method Summary

Methods
`void` `close(int status, ByteBuffer data)` Deprecated. Send a close message to the client
`protected void` `close(WsFrame frame)` Deprecated. Respond to a client close by sending a close that echoes the status code and message.
`void` `flush()` Deprecated. Flush any message (binary or textual) that may be buffered.
`void` `ping(ByteBuffer data)` Deprecated. Send a ping message to the client
`void` `pong(ByteBuffer data)` Deprecated. Send a pong message to the client
`void` `writeBinaryData(int b)` Deprecated. Adds the data to the buffer for binary data.
`void` `writeBinaryMessage(ByteBuffer msgBb)` Deprecated. 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)` Deprecated. Adds the data to the buffer for textual data.
`void` `writeTextMessage(CharBuffer msgCb)` Deprecated. 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

#### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

Deprecated.

See Also:
  Constant Field Values

### Constructor Detail

#### WsOutbound

    public WsOutbound(UpgradeOutbound upgradeOutbound,
              StreamInbound streamInbound)

Deprecated.

#### WsOutbound

    public WsOutbound(UpgradeOutbound upgradeOutbound,
              StreamInbound streamInbound,
              int byteBufferSize,
              int charBufferSize)

Deprecated.

### Method Detail

#### writeBinaryData

    public void writeBinaryData(int b)
                         throws IOException

Deprecated.
Adds the data to the buffer for binary data. If a textual message is currently in progress that message will be completed and a new binary message started. If the buffer for binary data is full, the buffer will be flushed and a new binary continuation fragment started.

Parameters:
  `b` - The byte (only the least significant byte is used) of data to send to the client.
Throws:
  `IOException` - If a flush is required and an error occurs writing the WebSocket frame to the client

#### writeTextData

    public void writeTextData(char c)
                       throws IOException

Deprecated.
Adds the data to the buffer for textual data. If a binary message is currently in progress that message will be completed and a new textual message started. If the buffer for textual data is full, the buffer will be flushed and a new textual continuation fragment started.

Parameters:
  `c` - The character to send to the client.
Throws:
  `IOException` - If a flush is required and an error occurs writing the WebSocket frame to the client

#### writeBinaryMessage

    public void writeBinaryMessage(ByteBuffer msgBb)
                            throws IOException

Deprecated.
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.

Parameters:
  `msgBb` - The buffer containing the payload
Throws:
  `IOException` - If an error occurs writing to the client

#### writeTextMessage

    public void writeTextMessage(CharBuffer msgCb)
                          throws IOException

Deprecated.
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.

Parameters:
  `msgCb` - The buffer containing the payload
Throws:
  `IOException` - If an error occurs writing to the client

#### flush

    public void flush()
               throws IOException

Deprecated.
Flush any message (binary or textual) that may be buffered.

Throws:
  `IOException` - If an error occurs writing to the client

#### close

    protected void close(WsFrame frame)
                  throws IOException

Deprecated.
Respond to a client close by sending a close that echoes the status code and message.

Parameters:
  `frame` - The close frame received from a client
Throws:
  `IOException` - If an error occurs writing to the client

#### close

    public void close(int status,
             ByteBuffer data)
               throws IOException

Deprecated.
Send a close message to the client

Parameters:
  `status` - Must be a valid status code or zero to send no code
  `data` - Optional message. If message is defined, a valid status code must be provided.
Throws:
  `IOException` - If an error occurs writing to the client

#### pong

    public void pong(ByteBuffer data)
              throws IOException

Deprecated.
Send a pong message to the client

Parameters:
  `data` - Optional message.
Throws:
  `IOException` - If an error occurs writing to the client

#### ping

    public void ping(ByteBuffer data)
              throws IOException

Deprecated.
Send a ping message to the client

Parameters:
  `data` - Optional message.
Throws:
  `IOException` - If an error occurs writing to the client