Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  *  Copyright (c) xlightweb.org, 2008 - 2010. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
  *  License as published by the Free Software Foundation; either
  *  version 2.1 of the License, or (at your option) any later version.
  *
  *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
 * The latest copy of this software may be found on http://www.xlightweb.org/
 */
package org.xlightweb;
import  org.xsocket.connection.IConnection;




WebSocketConnection

This is an experimental implementation of the Web Socket protocol draft and subject to change

Author(s):
grro@xlightweb.org
public interface IWebSocketConnection extends IConnection {
    
    
write the message synchronously

Parameters:
msg the message to write
Returns:
the message size
Throws:
IOException if a write error occurs
    int writeMessage(WebSocketMessage msgthrows IOException;
    
    
    
write the message asynchronously

Parameters:
msg the message
completeHandler the complete handler
Throws:
IOException if a write error occurs
    void writeMessage(WebSocketMessage msgIWebSocketMessageWriteCompleteHandler completeHandlerthrows IOException;
 
    
    
returns the available messages

Returns:
the available messages
    int availableMessages(); 
    
    
    
read the message. If no message is available, the method will block. The method IWebSocketConnection.availableMessages() can be used to check if a message is available

Returns:
the message
Throws:
IOException in an read error occurs
SocketTimeoutException if the read time out is exceeded
    WebSocketMessage readMessage() throws IOExceptionSocketTimeoutException;
    

    
returns the protocol

Returns:
the protocol or null
    String getProtocol();
    
    
destroy the connection
    void destroy();
New to GrepCode? Check out our FAQ X