IAudience Interface
Packages > @fluidframework/container-definitions > IAudience
Represents all clients connected to the op stream, both read-only and read/write.
Signature
export interface IAudience extends IEventProvider<IAudienceEvents>
Extends: IEventProvider <IAudienceEvents >
Remarks
Access to the Audience when a container is disconnected is a tricky subject. See the remarks on specific methods for more details.
Methods
Method | Return Type | Description |
---|---|---|
getMember(clientId) | IClient | undefined | Get details about the connected client with the specified clientId, or undefined if the specified client isn't connected. |
getMembers() | Map<string, IClient> | List all clients connected to the op stream, keyed off their clientId. |
getSelf() | ISelf | undefined | Returns information about client's connection. Please see ISelf member descriptions for more details. undefined if this client has never connected to the ordering service. Please see clientId for more details on when values returned by this function change over time. |
Method Details
getMember
Get details about the connected client with the specified clientId, or undefined if the specified client isn’t connected.
Signature
getMember(clientId: string): IClient | undefined;
Remarks
When the container is disconnected, there are no guarantees about the correctness of what this method returns. The default implementation in Fluid Framework continues to return members that were part of the audience when the container disconnected, but this could change in the future. Other implementations could decide to always return undefined, or only return an IClient when the local client is requested.
Note that the clientId that a disconnected container might see for itself is an old one. A disconnected container does not technically have a clientId tied to an active connection to the service.
Parameters
Parameter | Type | Description |
---|---|---|
clientId | string |
Returns
Return type: IClient | undefined
getMembers
List all clients connected to the op stream, keyed off their clientId.
Signature
getMembers(): Map<string, IClient>;
Remarks
When the container is disconnected, there are no guarantees about the correctness of what this method returns. The default implementation in Fluid Framework continues to return the list of members as it last saw it before the container disconnected, but this could change in the future. Other implementations could decide to return an empty list, or a list that only includes the local client.
Note that the clientId that a disconnected container might see for itself is an old one. A disconnected container does not technically have a clientId tied to an active connection to the service.
Returns
Return type: Map<string, IClient >
getSelf
Returns information about client’s connection. Please see ISelf member descriptions for more details. undefined if this client has never connected to the ordering service. Please see clientId for more details on when values returned by this function change over time.
Signature
getSelf(): ISelf | undefined;
Remarks
This API is experimental.
Reconnection process will have these phases: 1. Establishing connection phase: - new connection clientId is added to member’s list. That said, self.clientId still reflects old information. - The old client’s information is removed from members’ list. getMember(self.clientId) will return undefined. 2. Catch-up phase. Client catches up on latest ops and becomes current. 3. “connect” phase - the following happens synchronously: - getSelf() information changes to reflect new connection - “selfChanged” event on this object fires - Various API surfaces may expose “connected” event. This event fires at the same time as self changes. That said, “connected” event will not fire at IContainerRuntime layer if container is read-only.
That said, at the moment this is an experimental API. It depends on some experimental settings that might change in the future. Events described in phase #3 may not happen at the same time if kill-bit feature gates are engaged due to a bug discovered in new logic that delivers this functionality. Once it’s proven (at scale) that everything works well, experimental tag will be removed. Also application that deploy loader & container runtime bundles independently will see new (synchronized) behavior only when loader changes are deployed. Newer runtimes will continue to observe old (non-synchronized) behavior when paired with older loader code.
When promises in phase #3 are broken (due to conditions described above), consumers could experience current clientId being changed (and “selfChanged” event fired) while 1. Such clientId is not present in Audience 2. Client is not fully caught up
Returns
Return type: ISelf | undefined