Skip to main content

@fluidframework/presence Package

Package for client presence within a connected session.

See README.md for an overview of the package.

Interfaces

InterfaceAlertsModifiersDescription
AttendeesealedA client within a Fluid session (period of container connectivity to service).
AttendeesEventssealedEvents from attendees.
BroadcastControlssealedCommon controls for States objects.
BroadcastControlSettingsValue set to configure BroadcastControls.
LatestsealedState that provides the latest known value from this client to others and read access to their values. All participant clients must provide a value.
LatestArgumentsArguments that are passed to the @fluidframework/presence#StateFactory.latest function to create a Latest State object.
LatestArgumentsRawArguments that are passed to the @fluidframework/presence#StateFactory.latest function to create a LatestRaw State object.
LatestClientDatasealedState of a specific Attendee's value and its metadata.
LatestDatasealedState of a value and its metadata.
LatestEventssealedEvents from LatestRaw.
LatestFactorysealedFactory for creating a Latest or LatestRaw State object.
LatestMapsealedState that provides a Map of latest known values from this client to others and read access to their values. Entries in the map may vary over time and by client, but all values are expected to be of the same type, which may be a union type.
LatestMapArgumentsArguments that are passed to the StateFactory.latestMap function.
LatestMapArgumentsRawArguments that are passed to the StateFactory.latestMap function.
LatestMapClientDatasealedCollection of latest known values for a specific Attendee.
LatestMapEventssealedEvents from LatestMapRaw.
LatestMapFactorysealedFactory for creating a LatestMap or LatestMapRaw State object.
LatestMapItemRemovedClientDatasealedIdentifier and metadata for a removed item.
LatestMapItemUpdatedClientDatasealedState of a single item value, its key, and its metadata.
LatestMetadatasealedMetadata for the value state.
NotificationEmitterAlphasealedInterface for a notification emitter that can send typed notification to other clients.
NotificationListenableAlphasealedAn object which allows the registration of listeners so that subscribers can be notified when a notification happens.
NotificationsManagerAlphasealedProvides notifications from this client to others and subscription to their notifications.
NotificationsManagerEventsAlphasealed
NotificationsWorkspaceAlphasealedNotificationsWorkspace maintains a registry of NotificationsManagers that facilitate messages across client members in a session.
PresencesealedProvides top-level access to Presence feature set including known Attendees within a session and their custom states kept under StatesWorkspaces.
PresenceEventssealedEvents from Presence.
PresenceWithNotificationsAlphasealedProvides top-level access to Presence feature set including known Attendees within a session and their custom states and notifications kept under StatesWorkspaces and NotificationsWorkspaces.
ProxiedValueAccessorSystemRepresents a value that is accessed via a function call, which may result in no value.
RawValueAccessorSystemRepresents a value that is accessed directly.
StateMapsealedMap of local client's values. Modifications are transmitted to all other connected clients.
StatesWorkspacesealed

StatesWorkspace maintains a registry of State objects that all share and provide access to presence state values across client members in a session.

State objects offer variations on how to manage states, but all share same principle that each client's state is independent and may only be updated by originating client.

Types

TypeAliasAlertsModifiersDescription
AccessorSystemUtility type that conditionally represents an accessor type based on the base accessor type.
AttendeeIdA Fluid client session identifier.
AttendeeStatus

Represents the connection status of an Attendee.

This type can be either 'Connected' or 'Disconnected', indicating whether the attendee is currently connected to the Fluid service.

When 'Disconnected': - State changes are kept locally and communicated to others upon reconnect. - Notification requests are discarded (silently).

ClientConnectionIdA Fluid client connection identifier.
KeySchemaValidatorA validator function that can optionally be provided to do runtime validation of the custom key listed in a LatestMap.
LatestConfigurationsealedType alias for the return type of LatestFactory when called with LatestArguments.
LatestMapConfigurationsealedType alias for the return type of LatestMapFactory when called with LatestMapArguments.
LatestMapRawsealedState that provides a Map of latest known values from this client to others and read access to their values. Entries in the map may vary over time and by client, but all values are expected to be of the same type, which may be a union type.
LatestMapRawConfigurationsealedType alias for the return type of LatestMapFactory when called with LatestMapArgumentsRaw.
LatestMapRawEventssealedEvents from LatestMapRaw.
LatestRawsealedState that provides the latest known value from this client to others and read access to their values. All participant clients must provide a value.
LatestRawConfigurationsealedType alias for the return type of LatestFactory when called with LatestArgumentsRaw.
LatestRawEventssealedEvents from LatestRaw.
NotificationsConfigurationAlphasealedType alias for the return type of Notifications(initialSubscriptions).
NotificationSubscriberSignaturesAlphasealedRecord of notification subscription signatures transformed from listener emit signatures.
NotificationsWithSubscriptionsConfigurationAlphasealedType alias for the return type of Notifications(initialSubscriptions).
NotificationsWorkspaceSchemaAlpha

Schema for a NotificationsWorkspace workspace.

Keys of schema are the keys of the NotificationsWorkspace providing access to NotificationsManagers.

StateSchemaValidatorA validator function that can optionally be provided to do runtime validation of the custom data stored in a presence workspace and managed by a state object.
StatesWorkspaceEntriessealedMap of State objects registered with StatesWorkspace.
StatesWorkspaceEntrySingle entry in StatesWorkspaceSchema or NotificationsWorkspaceSchema.
StatesWorkspaceSchema

Schema for a StatesWorkspace workspace.

Keys of schema are the keys of the StatesWorkspace providing access to State objects.

ValueAccessorSystemUnion of possible accessor types for a value.
WorkspaceAddressUnique address within a session.

Functions

FunctionAlertsReturn TypeDescription
getPresence(fluidContainer)Deprecated, BetaPresenceAcquire a Presence from a Fluid Container
getPresenceFromDataStoreContext(context)LegacyPresenceGet Presence from a Fluid Data Store Context
Notifications(initialSubscriptions)AlphaNotificationsConfiguration<T, Key>Factory for creating a @fluid-internal/presence-definitions#NotificationsManager.
Notifications(initialSubscriptions)AlphaNotificationsWithSubscriptionsConfiguration<TSubscriptions, Key>Factory for creating a @fluid-internal/presence-definitions#NotificationsManager.

Variables

VariableModifiersTypeDescription
AttendeeStatusreadonly{ readonly Connected: "Connected"; readonly Disconnected: "Disconnected"; }The connection status of the Attendee.
StateFactoryreadonly{ readonly latest: import("@fluid-internal/presence-definitions").LatestFactory; readonly latestMap: import("@fluid-internal/presence-definitions").LatestMapFactory; }Factory for creating presence State objects.

Namespaces

NamespaceAlertsDescription
InternalPresenceTypesSystemCollection of value types that are not intended to be used/imported directly outside of this package.
InternalPresenceUtilityTypesSystemCollection of utility types that are not intended to be used/imported directly outside of this package.

Function Details

getPresence

Acquire a Presence from a Fluid Container

This API is deprecated and will be removed in a future release.

Import from fluid-framework instead. This export will be removed in the 2.110.0 release. See https://github.com/microsoft/FluidFramework/issues/26397

This API is provided as a beta preview and may change without notice.

To use, import via @fluidframework/presence/beta.

For more information about our API support guarantees, see here.

Signature

getPresence: (fluidContainer: IFluidContainer) => Presence

Parameters

ParameterTypeDescription
fluidContainerIFluidContainerFluid Container to acquire the map from

Returns

the Presence

Return type: Presence

getPresenceFromDataStoreContext

Get Presence from a Fluid Data Store Context

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/presence/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function getPresenceFromDataStoreContext(context: IFluidDataStoreContext): Presence;

Parameters

ParameterTypeDescription
contextIFluidDataStoreContext

Returns

Return type: Presence

Notifications

Factory for creating a @fluid-internal/presence-definitions#NotificationsManager.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/presence/alpha.

For more information about our API support guarantees, see here.

Signature

export declare function Notifications<T extends InternalPresenceUtilityTypes.NotificationListeners<T>, Key extends string = string>(initialSubscriptions: Partial<NotificationSubscriberSignatures<T>>): NotificationsConfiguration<T, Key>;
Type Parameters
ParameterConstraintDefaultDescription
TInternalPresenceUtilityTypes.NotificationListeners<T>
Keystringstring

Parameters

ParameterTypeDescription
initialSubscriptionsPartial<NotificationSubscriberSignatures<T>>

Returns

Return type: NotificationsConfiguration<T, Key>

Notifications

Factory for creating a @fluid-internal/presence-definitions#NotificationsManager.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/presence/alpha.

For more information about our API support guarantees, see here.

Signature

export declare function Notifications<TSubscriptions extends InternalPresenceUtilityTypes.NotificationListenersWithSubscriberSignatures<TSubscriptions>, Key extends string = string>(initialSubscriptions: Partial<TSubscriptions>): NotificationsWithSubscriptionsConfiguration<TSubscriptions, Key>;
Type Parameters
ParameterConstraintDefaultDescription
TSubscriptionsInternalPresenceUtilityTypes.NotificationListenersWithSubscriberSignatures<TSubscriptions>
Keystringstring

Parameters

ParameterTypeDescription
initialSubscriptionsPartial<TSubscriptions>

Returns

Return type: NotificationsWithSubscriptionsConfiguration<TSubscriptions, Key>

Variable Details

AttendeeStatus

The connection status of the Attendee.

Signature

AttendeeStatus: {
readonly Connected: "Connected";
readonly Disconnected: "Disconnected";
}

Type: { readonly Connected: "Connected"; readonly Disconnected: "Disconnected"; }

StateFactory

Factory for creating presence State objects.

Signature

StateFactory: {
readonly latest: import("@fluid-internal/presence-definitions").LatestFactory;
readonly latestMap: import("@fluid-internal/presence-definitions").LatestMapFactory;
}

Type: { readonly latest: import("@fluid-internal/presence-definitions").LatestFactory; readonly latestMap: import("@fluid-internal/presence-definitions").LatestMapFactory; }

Remarks

Use latest to create a LatestRaw State object. Use latestMap to create a LatestMapRaw State object.