public class

DefaultWebSocketListener

extends Object
implements WebSocketByteListener WebSocketPingListener WebSocketPongListener WebSocketTextListener
java.lang.Object
   ↳ com.ning.http.client.websocket.DefaultWebSocketListener

Class Overview

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.

Summary

Fields
protected WebSocket webSocket
Public Constructors
DefaultWebSocketListener()
Public Methods
void onClose(WebSocket websocket)
Invoked when the WebSocket is close.
void onError(Throwable t)
Invoked when the WebSocket is open.
void onFragment(byte[] fragment, boolean last)
Invoked when bytes of a fragmented message are available.
void onFragment(String fragment, boolean last)
Invoked when WebSocket text fragments are received.
void onMessage(byte[] message)
Invoked when bytes are available.
void onMessage(String message)
Invoked when WebSocket text message are received.
void onOpen(WebSocket websocket)
Invoked when the WebSocket is open.
void onPing(byte[] message)
Invoked when a ping message is received
void onPong(byte[] message)
Invoked when a pong message is received
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.ning.http.client.websocket.WebSocketByteListener
From interface com.ning.http.client.websocket.WebSocketListener
From interface com.ning.http.client.websocket.WebSocketPingListener
From interface com.ning.http.client.websocket.WebSocketPongListener
From interface com.ning.http.client.websocket.WebSocketTextListener

Fields

protected WebSocket webSocket

Public Constructors

public DefaultWebSocketListener ()

Public Methods

public void onClose (WebSocket websocket)

Invoked when the WebSocket is close.

public void onError (Throwable t)

Invoked when the WebSocket is open.

Parameters
t a Throwable

public void onFragment (byte[] fragment, boolean last)

Invoked when bytes of a fragmented message are available.

Parameters
fragment byte[] fragment.
last if this fragment is the last in the series.

public void onFragment (String fragment, boolean last)

Invoked when WebSocket text fragments are received.

Parameters
fragment text fragment
last if this fragment is the last of the series.

public void onMessage (byte[] message)

Invoked when bytes are available.

Parameters
message a byte array.

public void onMessage (String message)

Invoked when WebSocket text message are received.

Parameters
message a String message

public void onOpen (WebSocket websocket)

Invoked when the WebSocket is open.

public void onPing (byte[] message)

Invoked when a ping message is received

Parameters
message a byte array

public void onPong (byte[] message)

Invoked when a pong message is received

Parameters
message a byte array