Package com.ning.http.client.ws
Class DefaultWebSocketListener
java.lang.Object
com.ning.http.client.ws.DefaultWebSocketListener
- All Implemented Interfaces:
WebSocketByteListener,WebSocketListener,WebSocketPingListener,WebSocketPongListener,WebSocketTextListener
public class DefaultWebSocketListener
extends Object
implements WebSocketByteListener, WebSocketTextListener, WebSocketPingListener, WebSocketPongListener
Default WebSocketListener implementation. Most methods are no-ops. This
allows for quick override customization without clutter of methods that the
developer isn't interested in dealing with.
- Since:
- 1.7.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when theWebSocketis close.voidInvoked when theWebSocketis open.voidonMessage(byte[] message) Invoked when bytes are available.voidInvoked when WebSocket text message are received.voidInvoked when theWebSocketis open.voidonPing(byte[] message) Invoked when a ping message is receivedvoidonPong(byte[] message) Invoked when a pong message is received
-
Field Details
-
webSocket
-
-
Constructor Details
-
DefaultWebSocketListener
public DefaultWebSocketListener()
-
-
Method Details
-
onMessage
public void onMessage(byte[] message) Description copied from interface:WebSocketByteListenerInvoked when bytes are available.- Specified by:
onMessagein interfaceWebSocketByteListener- Parameters:
message- a byte array.
-
onPing
public void onPing(byte[] message) Description copied from interface:WebSocketPingListenerInvoked when a ping message is received- Specified by:
onPingin interfaceWebSocketPingListener- Parameters:
message- a byte array
-
onPong
public void onPong(byte[] message) Description copied from interface:WebSocketPongListenerInvoked when a pong message is received- Specified by:
onPongin interfaceWebSocketPongListener- Parameters:
message- a byte array
-
onMessage
Description copied from interface:WebSocketTextListenerInvoked when WebSocket text message are received.- Specified by:
onMessagein interfaceWebSocketTextListener- Parameters:
message- aStringmessage
-
onOpen
Description copied from interface:WebSocketListenerInvoked when theWebSocketis open.- Specified by:
onOpenin interfaceWebSocketListener
-
onClose
Description copied from interface:WebSocketListenerInvoked when theWebSocketis close.- Specified by:
onClosein interfaceWebSocketListener
-
onError
Description copied from interface:WebSocketListenerInvoked when theWebSocketis open.- Specified by:
onErrorin interfaceWebSocketListener- Parameters:
t- aThrowable
-