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;
 
 
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 {
    
    
    
sets/overrides the message handler

Parameters:
webSocketHandler the web socket handler to set
Throws:
java.io.IOException if an exception occurs
 
     void setMessageHandler(IWebSocketHandler webSocketHandlerthrows IOException;
    
    
    
write the message synchronously

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

Parameters:
msg the message
completeHandler the complete handler
Throws:
java.io.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 availableMessages() can be used to check if a message is available

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

    
returns the protocol

Returns:
the protocol or null
 
     String getProtocol();
    
    
    
returns the web socket origin

Returns:
the web socket origin
 
     String getWebSocketOrigin();
    
    
    
    
returns the web socket location

Returns:
the web socket location
    String getWebSocketLocation();

    
    
closes the connection
    void closeQuitly();
New to GrepCode? Check out our FAQ X