public class

NettyWebSocket

extends Object
implements WebSocket
java.lang.Object
   ↳ com.ning.http.client.providers.netty.NettyWebSocket

Summary

Public Constructors
NettyWebSocket(Channel channel)
Public Methods
WebSocket addWebSocketListener(WebSocketListener l)
void close()
Close the WebSocket.
boolean isOpen()
Returns true if the WebSocket is open/connected.
WebSocket sendMessage(byte[] message)
Send a byte message.
WebSocket sendPing(byte[] payload)
Send a ping with an optional payload (limited to 125 bytes or less).
WebSocket sendPong(byte[] payload)
Send a ping with an optional payload (limited to 125 bytes or less).
WebSocket sendTextMessage(String message)
Send a text message
WebSocket stream(byte[] fragment, boolean last)
Allows streaming of multiple binary fragments.
WebSocket stream(byte[] fragment, int offset, int len, boolean last)
Allows streaming of multiple binary fragments.
WebSocket streamText(String fragment, boolean last)
Allows streaming of multiple text fragments.
String toString()
Protected Methods
void onClose()
void onError(Throwable t)
void onMessage(byte[] message)
void onTextMessage(String message)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.ning.http.client.websocket.WebSocket

Public Constructors

public NettyWebSocket (Channel channel)

Public Methods

public WebSocket addWebSocketListener (WebSocketListener l)

Parameters
l a WebSocketListener
Returns
  • this

public void close ()

Close the WebSocket.

public boolean isOpen ()

Returns true if the WebSocket is open/connected.

Returns
  • true if the WebSocket is open/connected.

public WebSocket sendMessage (byte[] message)

Send a byte message.

Parameters
message a byte message
Returns
  • this

public WebSocket sendPing (byte[] payload)

Send a ping with an optional payload (limited to 125 bytes or less).

Parameters
payload the ping payload.
Returns
  • this.

public WebSocket sendPong (byte[] payload)

Send a ping with an optional payload (limited to 125 bytes or less).

Parameters
payload the pong payload.
Returns
  • this.

public WebSocket sendTextMessage (String message)

Send a text message

Parameters
message a text message
Returns
  • this.

public WebSocket stream (byte[] fragment, boolean last)

Allows streaming of multiple binary fragments.

Parameters
fragment binary fragment.
last flag indicating whether or not this is the last fragment.
Returns
  • this.

public WebSocket stream (byte[] fragment, int offset, int len, boolean last)

Allows streaming of multiple binary fragments.

Parameters
fragment binary fragment.
offset starting offset.
len length.
last flag indicating whether or not this is the last fragment.

public WebSocket streamText (String fragment, boolean last)

Allows streaming of multiple text fragments.

Parameters
fragment text fragment.
last flag indicating whether or not this is the last fragment.
Returns
  • this.

public String toString ()

Protected Methods

protected void onClose ()

protected void onError (Throwable t)

protected void onMessage (byte[] message)

protected void onTextMessage (String message)