private WebSocketOutputStream openOutputStream ( Socket socket ) throws WebSocketException { try { // Get the output stream of the socket through which // this client sends data to the server. return new WebSocketOutputStream ( new BufferedOutputStream ( socket . getOutputStream ( ) ) ) ; } catch ( IOException e ) { // Failed to get the output stream from the raw socket. throw new WebSocketException ( WebSocketError . SOCKET_OUTPUT_STREAM_FAILURE , "Failed to get the output stream from the raw socket: " + e . getMessage ( ) , e ) ; } }
Open the output stream of the WebSocket connection . The stream is used by the writing thread .