public interface

WebSocket

com.ning.http.client.websocket.WebSocket
Known Indirect Subclasses

Class Overview

A Websocket client

Summary

Public Methods
abstract WebSocket addWebSocketListener(WebSocketListener l)
abstract void close()
Close the WebSocket.
abstract boolean isOpen()
Returns true if the WebSocket is open/connected.
abstract WebSocket sendMessage(byte[] message)
Send a byte message.
abstract WebSocket sendPing(byte[] payload)
Send a ping with an optional payload (limited to 125 bytes or less).
abstract WebSocket sendPong(byte[] payload)
Send a ping with an optional payload (limited to 125 bytes or less).
abstract WebSocket sendTextMessage(String message)
Send a text message
abstract WebSocket stream(byte[] fragment, boolean last)
Allows streaming of multiple binary fragments.
abstract WebSocket stream(byte[] fragment, int offset, int len, boolean last)
Allows streaming of multiple binary fragments.
abstract WebSocket streamText(String fragment, boolean last)
Allows streaming of multiple text fragments.

Public Methods

public abstract WebSocket addWebSocketListener (WebSocketListener l)

Parameters
l a WebSocketListener
Returns
  • this

public abstract void close ()

Close the WebSocket.

public abstract boolean isOpen ()

Returns true if the WebSocket is open/connected.

Returns
  • true if the WebSocket is open/connected.

public abstract WebSocket sendMessage (byte[] message)

Send a byte message.

Parameters
message a byte message
Returns
  • this

public abstract 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 abstract 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 abstract WebSocket sendTextMessage (String message)

Send a text message

Parameters
message a text message
Returns
  • this.

public abstract 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 abstract 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 abstract 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.