com.caucho.websocket
Interface WebSocketContext

All Known Implementing Classes:
WebSocketClient, WebSocketContextStreamImpl

public interface WebSocketContext

Bidirectional TCP connection based on a HTTP upgrade, e.g. WebSocket. The context and its values are not thread safe. The DuplexListener thread normally is the only thread reading from the input stream.


Method Summary
 void close()
          gracefully close the connection, waiting for unread messages.
 void close(int code, java.lang.String message)
          gracefully close the connection, waiting for unread messages.
 void disconnect()
          Disconnect the connection.
 long getTimeout()
          Gets the read timeout.
 void pong(byte[] value)
          sends a pong message
 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.
 

Method Detail

startBinaryMessage

java.io.OutputStream startBinaryMessage()
                                        throws java.io.IOException
Returns the output stream for a binary message. The message will complete when the OutputStream is closed.

Throws:
java.io.IOException

startTextMessage

java.io.PrintWriter startTextMessage()
                                     throws java.io.IOException
Returns the output stream for a binary message. The message will complete when the Writer is closed.

Throws:
java.io.IOException

setTimeout

void setTimeout(long timeout)
Sets the read timeout.


getTimeout

long getTimeout()
Gets the read timeout.


close

void close()
gracefully close the connection, waiting for unread messages.


close

void close(int code,
           java.lang.String message)
gracefully close the connection, waiting for unread messages.


pong

void pong(byte[] value)
          throws java.io.IOException
sends a pong message

Throws:
java.io.IOException

disconnect

void disconnect()
Disconnect the connection.