com.smaxe.uv.client
Interface INetConnection

All Known Implementing Classes:
NetConnection

public interface INetConnection

INetConnection - RTMP/RTMPT/RTMPS connection (replica of ActionScript's NetConnection class interface).

Version:
1.5.12
Author:
Andrei Sochirca
See Also:
JUV RTMP Client

Nested Class Summary
static class INetConnection.Configuration
          Configuration - INetConnection configuration constants.
static interface INetConnection.IListener
          IListener - NetConnection listener.
static class INetConnection.ListenerAdapter
          ListenerAdapter - INetConnection.IListener adapter.
 
Field Summary
static java.lang.String CALL_BADVERSION
          The URI specified in the NetConnection.connect method did not specify 'rtmp' as the protocol.
static java.lang.String CALL_FAILED
          The NetConnection.call method was not able to invoke the server-side method or command.
static java.lang.String CONNECT_APPSHUTDOWN
          The application has been shut down (for example, if the application is out of memory resources and must shut down to prevent the server from crashing) or the server has shut down.
static java.lang.String CONNECT_BANDWIDTH
          Connection bandwidth.
static java.lang.String CONNECT_CLOSED
          The connection was closed successfully
static java.lang.String CONNECT_FAILED
          The connection attempt failed.
static java.lang.String CONNECT_INVALID_APPLICATION
          The application name specified during connect is invalid.
static java.lang.String CONNECT_REJECTED
          The client does not have permission to connect to the application, the application expected different parameters from those that were passed, or the application name specified during the connection attempt was not found on the server.
static java.lang.String CONNECT_SUCCESS
          The connection attempt succeeded.
static ObjectEncoding defaultObjectEncoding
          Default object encoding.
static java.lang.String PROXY_TYPE_BEST
          PROXY_TYPE_BEST - "best"
static java.lang.String PROXY_TYPE_CONNECT
          PROXY_TYPE_CONNECT - "CONNECT"
static java.lang.String PROXY_TYPE_HTTP
          PROXY_TYPE_HTTP - "HTTP"
static java.lang.String PROXY_TYPE_NONE
          PROXY_TYPE_NONE - "none"
 
Method Summary
 void addEventListener(INetConnection.IListener listener)
          Registers an event listener.
 void addHeader(java.lang.String operation, boolean mustUnderstand, java.lang.Object param)
          Adds a context header to the AMF packet structure.
 void call(java.lang.String command, Responder responder, java.lang.Object... args)
          Invokes a command or method on the server, or on an application server, to which the application instance is connected.
 java.lang.Object client()
          Returns the object on which callback methods should be invoked.
 void client(java.lang.Object client)
          Sets the object on which callback methods should be invoked.
 void close()
          Closes the connection.
 java.util.Map<java.lang.String,java.lang.Object> configuration()
          Returns NetConnection configuration.
 void connect(java.lang.String url, java.lang.Object... args)
          Opens a connection to a server.
 boolean connected()
          Checks if it is connected to the server.
 java.lang.String connectedProxyType()
          If a successful connection is made, indicates the method that was used to make it: a direct connection, the CONNECT method, or HTTP tunneling.
 ProtocolLayerInfo getInfo()
          Returns connection info (read/written bytes/packets).
 int getUploadBufferSize()
          Returns upload buffer size.
 ObjectEncoding objectEncoding()
          Returns object encoding.
 void objectEncoding(ObjectEncoding encoding)
          The object encoding (AMF version).
 java.lang.String proxyType()
          Returns proxy type.
 void proxyType(java.lang.String type)
          Determines whether native SSL is used for RTMPS instead of HTTPS, and whether the CONNECT method of tunneling is used to connect through a proxy server.
 void removeEventListener(INetConnection.IListener listener)
          Removes the listener.
 void setMaxUploadBandwidth(int bandwidth)
          Sets max upload bandwidth (in bytes per second).
 java.lang.String uri()
          The URI of the application server that was passed to connect(String, Object[]), if connect(String, Object[]) was used to connect to a server.
 boolean usingTLS()
          Indicates whether a secure connection was made using native Transport Layer Security (TLS) rather than HTTPS.
 

Field Detail

PROXY_TYPE_NONE

static final java.lang.String PROXY_TYPE_NONE
PROXY_TYPE_NONE - "none"

See Also:
Constant Field Values

PROXY_TYPE_HTTP

static final java.lang.String PROXY_TYPE_HTTP
PROXY_TYPE_HTTP - "HTTP"

See Also:
Constant Field Values

PROXY_TYPE_CONNECT

static final java.lang.String PROXY_TYPE_CONNECT
PROXY_TYPE_CONNECT - "CONNECT"

See Also:
Constant Field Values

PROXY_TYPE_BEST

static final java.lang.String PROXY_TYPE_BEST
PROXY_TYPE_BEST - "best"

See Also:
Constant Field Values

CALL_FAILED

static final java.lang.String CALL_FAILED
The NetConnection.call method was not able to invoke the server-side method or command.

See Also:
Constant Field Values

CALL_BADVERSION

static final java.lang.String CALL_BADVERSION
The URI specified in the NetConnection.connect method did not specify 'rtmp' as the protocol. 'rtmp' must be specified when connecting to FMS and Red5. Either not supported version of AMF was used (3 when only 0 is supported)

See Also:
Constant Field Values

CONNECT_APPSHUTDOWN

static final java.lang.String CONNECT_APPSHUTDOWN
The application has been shut down (for example, if the application is out of memory resources and must shut down to prevent the server from crashing) or the server has shut down.

See Also:
Constant Field Values

CONNECT_CLOSED

static final java.lang.String CONNECT_CLOSED
The connection was closed successfully

See Also:
Constant Field Values

CONNECT_FAILED

static final java.lang.String CONNECT_FAILED
The connection attempt failed.

See Also:
Constant Field Values

CONNECT_REJECTED

static final java.lang.String CONNECT_REJECTED
The client does not have permission to connect to the application, the application expected different parameters from those that were passed, or the application name specified during the connection attempt was not found on the server.

See Also:
Constant Field Values

CONNECT_SUCCESS

static final java.lang.String CONNECT_SUCCESS
The connection attempt succeeded.

See Also:
Constant Field Values

CONNECT_INVALID_APPLICATION

static final java.lang.String CONNECT_INVALID_APPLICATION
The application name specified during connect is invalid.

See Also:
Constant Field Values

CONNECT_BANDWIDTH

static final java.lang.String CONNECT_BANDWIDTH
Connection bandwidth.

Note:
This event is introduced in the JUV RTMP Client library and not available in ActionScript/FMS interaction.

See Also:
Constant Field Values

defaultObjectEncoding

static final ObjectEncoding defaultObjectEncoding
Default object encoding.

Method Detail

client

void client(java.lang.Object client)
Sets the object on which callback methods should be invoked.

Parameters:
client - the object on which callback methods should be invoked

client

java.lang.Object client()
Returns the object on which callback methods should be invoked.

Returns:
the object on which callback methods should be invoked

connected

boolean connected()
Checks if it is connected to the server. 'Connected' means that the connection is accepted by the server ("NetConnection.Connect.Success" response is received on 'connect' request), rather than a 'physical' connection is established.

Returns:
true if connected; false otherwise

connectedProxyType

java.lang.String connectedProxyType()
If a successful connection is made, indicates the method that was used to make it: a direct connection, the CONNECT method, or HTTP tunneling.

Returns:
connection proxy type

objectEncoding

ObjectEncoding objectEncoding()
Returns object encoding.

Returns:
object encoding

objectEncoding

void objectEncoding(ObjectEncoding encoding)
The object encoding (AMF version).

Parameters:
encoding - object encoding

proxyType

java.lang.String proxyType()
Returns proxy type.

Returns:
proxy type

proxyType

void proxyType(java.lang.String type)
Determines whether native SSL is used for RTMPS instead of HTTPS, and whether the CONNECT method of tunneling is used to connect through a proxy server.

Parameters:
type - proxy type

uri

java.lang.String uri()
The URI of the application server that was passed to connect(String, Object[]), if connect(String, Object[]) was used to connect to a server.

Returns:
uri application server uri

usingTLS

boolean usingTLS()
Indicates whether a secure connection was made using native Transport Layer Security (TLS) rather than HTTPS.

Returns:
TLS?

addHeader

void addHeader(java.lang.String operation,
               boolean mustUnderstand,
               java.lang.Object param)
Adds a context header to the AMF packet structure. This header is sent with every future AMF packet.

Parameters:
operation - identifies the header and the object data associated with it
mustUnderstand - (default = false) — A value of true indicates that the server must understand and process this header before it handles any of the following headers or messages.
param - (default = null) — any object

call

void call(java.lang.String command,
          Responder responder,
          java.lang.Object... args)
Invokes a command or method on the server, or on an application server, to which the application instance is connected. You must create a server-side function to pass to this method.

Parameters:
command - command
responder - an optional object that is used to handle return values from the server
args - command arguments

connect

void connect(java.lang.String url,
             java.lang.Object... args)
Opens a connection to a server. Through this connection, you can play back audio or video (FLV) files from an HTTP address or from the local file system, or you can invoke commands on a remote server.

Parameters:
url - url to connect
args - connection arguments

close

void close()
Closes the connection.


addEventListener

void addEventListener(INetConnection.IListener listener)
Registers an event listener.

Parameters:
listener - listener to add

removeEventListener

void removeEventListener(INetConnection.IListener listener)
Removes the listener.

Parameters:
listener - listener to remove

configuration

java.util.Map<java.lang.String,java.lang.Object> configuration()
Returns NetConnection configuration. Check INetConnection.Configuration class constants for configuration properties.

Returns:
configuration

getInfo

ProtocolLayerInfo getInfo()
Returns connection info (read/written bytes/packets).

Returns:
overall connection info

getUploadBufferSize

int getUploadBufferSize()
Returns upload buffer size.

Returns:
upload buffer size

setMaxUploadBandwidth

void setMaxUploadBandwidth(int bandwidth)
Sets max upload bandwidth (in bytes per second).

Note:
- you can change max upload bandwidth after connection is established only if INetConnection.Configuration.MAX_UPLOAD_BANDWIDTH configuration property was set positive before connection is established.

Parameters:
bandwidth - max upload bandwidth