Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.red5.server.api
Interface IConnection

All Superinterfaces:
  AttributeStoreMBean, ConnectionMBean, IAttributeStore, ICastingAttributeStore, ICoreObject, IEventDispatcher, IEventHandler, IEventListener

All Known Subinterfaces:
  IRemotingConnection, IServiceCapableConnection, IStreamCapableConnection

All Known Implementing Classes:
  BaseConnection, BaseRTMPTConnection, EdgeRTMPMinaConnection, RemotingConnection, RTMPConnection, RTMPMinaConnection, RTMPOriginConnection, RTMPTClientConnection, RTMPTConnection

    public interface IConnection

extends ConnectionMBean, ICoreObject

The connection object. Each connection has an associated client and scope. Connections may be persistent, polling, or transient. The aim of this interface is to provide basic connection methods shared between different types of connections Future subclasses: RTMPConnection, RemotingConnection, AJAXConnection, HttpConnection, etc

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard (luke@codegent.com)

Nested Class Summary
`static class` | `IConnection.Encoding` AMF version types, either AMF0 or AMF3.

Field Summary
`static String` | `PERSISTENT` Persistent connection type, eg RTMP.
`static String` | `POLLING` Polling connection type, eg RTMPT.
`static String` | `TRANSIENT` Transient connection type, eg Remoting, HTTP, etc.

Method Summary
`void` | `close()` Close this connection.
`boolean` | `connect(IScope scope)` Try to connect to the scope.
`boolean` | `connect(IScope scope, Object[] params)` Try to connect to the scope with a list of connection parameters.
`Iterator<IBasicScope>` | `getBasicScopes()` Get the basic scopes this connection has subscribed.
`IClient` | `getClient()` Get the client object associated with this connection.
`long` | `getClientBytesRead()` Return number of written bytes the client reports to have received.
`Map<String,Object>` | `getConnectParams()` Return the parameters that were given in the call to "connect".
`long` | `getDroppedMessages()` Total number of messages that have been dropped.
`IConnection.Encoding` | `getEncoding()` Get the object encoding (AMF version) for this connection.
`String` | `getHost()` Get the hostname that the client is connected to.
`int` | `getLastPingTime()` Return roundtrip time of last ping command.
`String` | `getPath()` Get the path for this connection.
`long` | `getPendingMessages()` Total number of messages that are pending to be sent to the connection.
`long` | `getReadBytes()` Total number of bytes read from the connection.
`long` | `getReadMessages()` Total number of messages read from the connection.
`String` | `getRemoteAddress()` Get the IP address the client is connected from.
`List<String>` | `getRemoteAddresses()` Get the IP addresses the client is connected from.
`int` | `getRemotePort()` Get the port the client is connected from.
`IScope` | `getScope()` Get the scope this is connected to.
`String` | `getSessionId()` Get the session id, this may be `null`.
`String` | `getType()` Get the connection type.
`long` | `getWrittenBytes()` Total number of bytes written to the connection.
`long` | `getWrittenMessages()` Total number of messages written to the connection.
`void` | `initialize(IClient client)` Initialize the connection.
`boolean` | `isConnected()` Is the client connected to the scope.
`void` | `ping()` Start measuring the roundtrip time for a packet on the connection.

Methods inherited from interface org.red5.server.api.ICastingAttributeStore
`getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute`

Methods inherited from interface org.red5.server.api.IAttributeStore
`getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes`

Methods inherited from interface org.red5.server.api.event.IEventDispatcher
`dispatchEvent`

Methods inherited from interface org.red5.server.api.event.IEventHandler
`handleEvent`

Methods inherited from interface org.red5.server.api.event.IEventListener
`notifyEvent`

Field Detail

### PERSISTENT

    static final String PERSISTENT

  Persistent connection type, eg RTMP.

  See Also:
    Constant Field Values

### POLLING

    static final String POLLING

  Polling connection type, eg RTMPT.

  See Also:
    Constant Field Values

### TRANSIENT

    static final String TRANSIENT

  Transient connection type, eg Remoting, HTTP, etc.

  See Also:
    Constant Field Values

Method Detail

### getType

    String getType()

  Get the connection type.

  Specified by:
    `getType` in interface `ConnectionMBean`
  Returns:
    string containing one of connection types

### getEncoding

    IConnection.Encoding getEncoding()

  Get the object encoding (AMF version) for this connection.

  Returns:
    the used encoding.

### initialize

    void initialize(IClient client)

  Initialize the connection.

  Specified by:
    `initialize` in interface `ConnectionMBean`
  Parameters:
    `client` - Client object associated with connection

### connect

    boolean connect(IScope scope)

  Try to connect to the scope.

  Specified by:
    `connect` in interface `ConnectionMBean`
  Parameters:
    `scope` - Scope object
  Returns:
    `true` on success, `false` otherwise

### connect

    boolean connect(IScope scope,
                    Object[] params)

  Try to connect to the scope with a list of connection parameters.

  Specified by:
    `connect` in interface `ConnectionMBean`
  Parameters:
    `params` - Connections parameters
    `scope` - Scope object
  Returns:
    `true` on success, `false` otherwise

### isConnected

    boolean isConnected()

  Is the client connected to the scope. Result depends on connection type, `true` for persistent and polling connections, `false` for transient.

  Specified by:
    `isConnected` in interface `ConnectionMBean`
  Returns:
    `true` if the connection is persistent or polling, otherwise `false`

### close

    void close()

  Close this connection. This will disconnect the client from the associated scope.

  Specified by:
    `close` in interface `ConnectionMBean`

### getConnectParams

    Map<String,Object> getConnectParams()

  Return the parameters that were given in the call to "connect".

  Specified by:
    `getConnectParams` in interface `ConnectionMBean`
  Returns:
    Connection parameters passed from client-side (Flex/Flash application)

### getClient

    IClient getClient()

  Get the client object associated with this connection.

  Specified by:
    `getClient` in interface `ConnectionMBean`
  Returns:
    Client object

### getHost

    String getHost()

  Get the hostname that the client is connected to. If they are connected to an IP, the IP address will be returned as a String.

  Specified by:
    `getHost` in interface `ConnectionMBean`
  Returns:
    String containing the hostname

### getRemoteAddress

    String getRemoteAddress()

  Get the IP address the client is connected from.

  Specified by:
    `getRemoteAddress` in interface `ConnectionMBean`
  Returns:
    The IP address of the client

### getRemoteAddresses

    List<String> getRemoteAddresses()

  Get the IP addresses the client is connected from. If a client is connected through RTMPT and uses a proxy to connect, this will contain all hosts the client used to connect to the server.

  Specified by:
    `getRemoteAddresses` in interface `ConnectionMBean`
  Returns:
    The IP addresses of the client

### getRemotePort

    int getRemotePort()

  Get the port the client is connected from.

  Specified by:
    `getRemotePort` in interface `ConnectionMBean`
  Returns:
    The port of the client

### getPath

    String getPath()

  Get the path for this connection. This is not updated if you switch scope.

  Specified by:
    `getPath` in interface `ConnectionMBean`
  Returns:
    path Connection path

### getSessionId

    String getSessionId()

  Get the session id, this may be `null`.

  Specified by:
    `getSessionId` in interface `ConnectionMBean`
  Returns:
    Session id

### getReadBytes

    long getReadBytes()

  Total number of bytes read from the connection.

  Specified by:
    `getReadBytes` in interface `ConnectionMBean`
  Returns:
    Number of read bytes

### getWrittenBytes

    long getWrittenBytes()

  Total number of bytes written to the connection.

  Specified by:
    `getWrittenBytes` in interface `ConnectionMBean`
  Returns:
    Number of written bytes

### getReadMessages

    long getReadMessages()

  Total number of messages read from the connection.

  Specified by:
    `getReadMessages` in interface `ConnectionMBean`
  Returns:
    Number of read messages

### getWrittenMessages

    long getWrittenMessages()

  Total number of messages written to the connection.

  Specified by:
    `getWrittenMessages` in interface `ConnectionMBean`
  Returns:
    Number of written messages

### getDroppedMessages

    long getDroppedMessages()

  Total number of messages that have been dropped.

  Specified by:
    `getDroppedMessages` in interface `ConnectionMBean`
  Returns:
    Number of dropped messages

### getPendingMessages

    long getPendingMessages()

  Total number of messages that are pending to be sent to the connection.

  Specified by:
    `getPendingMessages` in interface `ConnectionMBean`
  Returns:
    Number of pending messages

### getClientBytesRead

    long getClientBytesRead()

  Return number of written bytes the client reports to have received. This is the last value of the BytesRead message received from a client.

  Returns:
    number of written bytes received by the client
  See Also:
    `BytesRead`

### ping

    void ping()

  Start measuring the roundtrip time for a packet on the connection.

  Specified by:
    `ping` in interface `ConnectionMBean`

### getLastPingTime

    int getLastPingTime()

  Return roundtrip time of last ping command.

  Specified by:
    `getLastPingTime` in interface `ConnectionMBean`
  Returns:
    roundtrip time in milliseconds

### getScope

    IScope getScope()

  Get the scope this is connected to.

  Specified by:
    `getScope` in interface `ConnectionMBean`
  Returns:
    The connected scope

### getBasicScopes

    Iterator<IBasicScope> getBasicScopes()

  Get the basic scopes this connection has subscribed. This list will contain the shared objects and broadcast streams the connection connected to.

  Specified by:
    `getBasicScopes` in interface `ConnectionMBean`
  Returns:
    List of basic scopes

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 The Red5 Project