## InfcSessionProxy InfcSessionProxy — Client-side session management |

## Stability Level

Unstable, unless otherwise indicated

## Functions

void | infc_session_proxy_set_connection ()
InfXmlConnection * | infc_session_proxy_get_connection ()
InfCommunicationJoinedGroup * | infc_session_proxy_get_subscription_group ()

## Properties

InfXmlConnection * | connection | Read
InfCommunicationJoinedGroup * | subscription-group | Read

## Types and Values

struct | InfcSessionProxy
struct | InfcSessionProxyClass

## Object Hierarchy

        GObject
        ╰── InfcSessionProxy

## Implemented Interfaces

InfcSessionProxy implements InfCommunicationObject and InfSessionProxy.

## Includes

    #include <libinfinity/client/infc-session-proxy.h>

## Description

InfcSessionProxy is a manager for InfSession that is specific for the client side. The InfcSessionProxy manages exactly one InfSession. It is usually created by InfcBrowser when a subscription to a node is made.

InfcSessionProxy allows to perform client-specific operations for the session it manages, such as joining a user. In addition it handles requests made by its counterpart, InfdSessionProxy, for the server side, such as remote user joins and forced session closure.

InfcSessionProxy implements the InfSessionProxy interface, which can be used to access the underlying InfSession or to join a user.

## Functions

### infc_session_proxy_set_connection ()

    void
    infc_session_proxy_set_connection (InfcSessionProxy *proxy,
                                       InfCommunicationJoinedGroup *group,
                                       InfXmlConnection *connection,
                                       guint seq_id);

Sets the subscription connection for the given session. The subscription connection is the connection through which session requests are transmitted during subscription.

The subscription connection might be set even if the session is in SYNCHRONIZING state in which case the session is immediately subscribed after synchronization. Note that no attempt is made to tell the other end about the subscription.

`seq_id` should be a sequence identifier obtained from the server side. It must be the same number that is used on the corresponding InfdSessionProxy on the remote side, see `infd_session_proxy_subscribe_to()`. Normally InfdDirectory or InfcBrowser, respectively, take care of passing the correct sequence identifier.

When the subscription connection is being closed or replaced (by a subsequent call to this function), all pending requests are dropped and all users are set to be unavailable, but the session will not be closed, so it may be reused by setting another subscription connection. However, the session might not be synchronized again, but it is fully okay to close the session by hand (using inf_session_close) and create a new session that is synchronized.

#### Parameters

proxy | A InfcSessionProxy. |
group | A InfCommunicationJoinedGroup of subscribed connections. Ignored if `connection` is `NULL`. |
connection | A InfXmlConnection. |
seq_id | A sequence identifier for `connection` . Ignored if `connection` is `NULL`. |

### infc_session_proxy_get_connection ()

    InfXmlConnection *
    infc_session_proxy_get_connection (InfcSessionProxy *proxy);

Returns the connection that is used to transmit requests to the publisher of the session, or `NULL` if the session is not subscribed.

#### Parameters

proxy | A InfcSessionProxy. |

#### Returns

A InfXmlConnection, or `NULL`.

[transfer none]

### infc_session_proxy_get_subscription_group ()

    InfCommunicationJoinedGroup *
    infc_session_proxy_get_subscription_group
                                   (InfcSessionProxy *proxy);

Returns the group with all subscribed connections to the session, or `NULL` if the session is not subscribed.

#### Parameters

proxy | A InfcSessionProxy. |

#### Returns

A InfCommunicationJoinedGroup, or `NULL`.

[transfer none]

## Types and Values

### struct InfcSessionProxy

    struct InfcSessionProxy;

InfcSessionProxy is an opaque data type. You should only access it via the public API functions.

### struct InfcSessionProxyClass

    struct InfcSessionProxyClass {
      GError* (*translate_error)(InfcSessionProxy* session,
                                 GQuark domain,
                                 guint code);
    };

This structure contains virtual functions of the InfcSessionProxy class.

#### Members

`translate_error` () | Virtual function to transform an error domain and code into a GError object. If the domain and code are known, this allows to show a localized error message to the user, independent from the language the server uses in the error message that went over the wire. |

## Property Details

### The `“connection”` property

      “connection”               InfXmlConnection *

The connection with which the session communicates with the server.

Owner: InfcSessionProxy

Flags: Read

### The `“subscription-group”` property

      “subscription-group”       InfCommunicationJoinedGroup *

The communication group of subscribed connections.

Owner: InfcSessionProxy

Flags: Read

## See Also

InfSession