com.sun.grizzly.websockets
Class BaseWebSocket

java.lang.Object
  extended by com.sun.grizzly.websockets.BaseWebSocket
All Implemented Interfaces:
WebSocket
Direct Known Subclasses:
BaseServerWebSocket, ClientWebSocket, NioClientWebSocket

public class BaseWebSocket
extends Object
implements WebSocket


Field Summary
protected static Logger logger
           
 
Constructor Summary
BaseWebSocket(WebSocketListener... listeners)
           
 
Method Summary
 boolean add(WebSocketListener listener)
           
 void close()
           
 List<WebSocketListener> getListeners()
           
 NetworkHandler getNetworkHandler()
           
 boolean isConnected()
           
 void onClose()
           
 void onConnect()
           
 void onMessage(DataFrame frame)
           
 boolean remove(WebSocketListener listener)
           
 void send(DataFrame frame)
           
 void send(String data)
          Write the data to the socket.
 void setNetworkHandler(NetworkHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
Constructor Detail

BaseWebSocket

public BaseWebSocket(WebSocketListener... listeners)
Method Detail

getNetworkHandler

public NetworkHandler getNetworkHandler()

setNetworkHandler

public void setNetworkHandler(NetworkHandler handler)

getListeners

public List<WebSocketListener> getListeners()

isConnected

public boolean isConnected()
Specified by:
isConnected in interface WebSocket

add

public final boolean add(WebSocketListener listener)
Specified by:
add in interface WebSocket

close

public void close()
           throws IOException
Specified by:
close in interface WebSocket
Throws:
IOException

onClose

public void onClose()
             throws IOException
Specified by:
onClose in interface WebSocket
Throws:
IOException

remove

public final boolean remove(WebSocketListener listener)
Specified by:
remove in interface WebSocket

send

public void send(String data)
          throws IOException
Description copied from interface: WebSocket
Write the data to the socket. This text will be converted to a UTF-8 encoded byte[] prior to sending.

Specified by:
send in interface WebSocket
Throws:
IOException

send

public void send(DataFrame frame)
          throws IOException
Specified by:
send in interface WebSocket
Throws:
IOException

onConnect

public void onConnect()
               throws IOException
Specified by:
onConnect in interface WebSocket
Throws:
IOException

onMessage

public void onMessage(DataFrame frame)
               throws IOException
Specified by:
onMessage in interface WebSocket
Throws:
IOException


Copyright © 2011 Oracle Corpration. All Rights Reserved.