org.glassfish.grizzly.websockets
Class WebSocketClientHandler<W extends WebSocket>
java.lang.Object
org.glassfish.grizzly.websockets.WebSocketClientHandler<W>
- All Implemented Interfaces:
- WebSocketHandler<W>
public abstract class WebSocketClientHandler<W extends WebSocket>
- extends Object
- implements WebSocketHandler<W>
Abstract client-side WebSocketHandler, which will handle
client WebSockets events.
- Author:
- Alexey Stashok
- See Also:
WebSocketHandler,
WebSocketApplication
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WebSocketClientHandler
public WebSocketClientHandler()
onConnect
public abstract void onConnect(W websocket)
throws IOException
- The method is called, when client-side
WebSocket gets connected.
Usually this method is called right after client-server handshake validatation is completed.
- Parameters:
websocket - connected WebSocket.
- Throws:
IOException
handshake
protected void handshake(W socket,
ServerWebSocketMeta serverMeta)
throws HandshakeException
- Method is called, when inital
WebSocket handshake process was completed,
but WebSocketClientHandler may perform additional validation.
- Parameters:
socket - WebSocketserverMeta - ServerWebSocketMeta.
- Throws:
HandshakeException - error, occurred during the handshake.
createWebSocket
protected W createWebSocket(Connection connection,
ClientWebSocketMeta meta)
- Method is called before the
WebSocketEngine will create a client-side
WebSocket object, so the handler may return any customized
subtype of WebSocket.
- Parameters:
connection - underlying Grizzly Connection.meta - client-side WebSocketMeta.
- Returns:
- customized
WebSocket, or null, if handler wants
to delegate WebSocket creation to WebSocketEngine.
Copyright © 2010 Oracle Corpration. All Rights Reserved.