|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.java_websocket.WebSocketAdapter
public abstract class WebSocketAdapter
This class default implements all methods of the WebSocketListener that can be overridden optionally when advances functionalities is needed.
Constructor Summary | |
---|---|
WebSocketAdapter()
|
Method Summary | |
---|---|
String |
getFlashPolicy(WebSocket conn)
Gets the XML string that should be returned if a client requests a Flash security policy. |
void |
onWebsocketHandshakeReceivedAsClient(WebSocket conn,
ClientHandshake request,
ServerHandshake response)
Called on the client side when the socket connection is first established, and the WebSocketImpl handshake response has been received. |
ServerHandshakeBuilder |
onWebsocketHandshakeReceivedAsServer(WebSocket conn,
Draft draft,
ClientHandshake request)
This default implementation does not do anything. |
void |
onWebsocketHandshakeSentAsClient(WebSocket conn,
ClientHandshake request)
This default implementation does not do anything which will cause the connections to always progress. |
void |
onWebsocketMessageFragment(WebSocket conn,
Framedata frame)
This default implementation does not do anything. |
void |
onWebsocketPing(WebSocket conn,
Framedata f)
This default implementation will send a pong in response to the received ping. |
void |
onWebsocketPong(WebSocket conn,
Framedata f)
This default implementation does not do anything. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.java_websocket.WebSocketListener |
---|
getLocalSocketAddress, getRemoteSocketAddress, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand |
Constructor Detail |
---|
public WebSocketAdapter()
Method Detail |
---|
public ServerHandshakeBuilder onWebsocketHandshakeReceivedAsServer(WebSocket conn, Draft draft, ClientHandshake request) throws InvalidDataException
onWebsocketHandshakeReceivedAsServer
in interface WebSocketListener
conn
- The WebSocket related to this eventdraft
- The protocol draft the client uses to connectrequest
- The opening http message send by the client. Can be used to access additional fields like cookies.
InvalidDataException
- Throwing this exception will cause this handshake to be rejectedWebSocketListener.onWebsocketHandshakeReceivedAsServer(WebSocket, Draft, ClientHandshake)
public void onWebsocketHandshakeReceivedAsClient(WebSocket conn, ClientHandshake request, ServerHandshake response) throws InvalidDataException
WebSocketListener
onWebsocketHandshakeReceivedAsClient
in interface WebSocketListener
conn
- The WebSocket related to this eventrequest
- The handshake initially send out to the server by this websocket.response
- The handshake the server sent in response to the request.
InvalidDataException
- Allows the client to reject the connection with the server in respect of its handshake response.public void onWebsocketHandshakeSentAsClient(WebSocket conn, ClientHandshake request) throws InvalidDataException
onWebsocketHandshakeSentAsClient
in interface WebSocketListener
conn
- The WebSocket related to this eventrequest
- The handshake sent to the server by this websocket
InvalidDataException
- Allows the client to stop the connection from progressingWebSocketListener.onWebsocketHandshakeSentAsClient(WebSocket, ClientHandshake)
public void onWebsocketMessageFragment(WebSocket conn, Framedata frame)
onWebsocketMessageFragment
in interface WebSocketListener
WebSocketListener.onWebsocketMessageFragment(WebSocket, Framedata)
public void onWebsocketPing(WebSocket conn, Framedata f)
onWebsocketPing
in interface WebSocketListener
f
- The ping frame. Control frames may contain payload.WebSocketListener.onWebsocketPing(WebSocket, Framedata)
public void onWebsocketPong(WebSocket conn, Framedata f)
onWebsocketPong
in interface WebSocketListener
org.java_websocket.WebSocketListener#onWebsocketPong(WebSocket, Framedata)
public String getFlashPolicy(WebSocket conn)
getFlashPolicy
in interface WebSocketListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |