-
Presence updates are now grouped and throttled (#23075) abde76d8de
Presence updates are grouped together and throttled to prevent flooding the network with messages when presence values are rapidly updated. This means the presence infrastructure will not immediately broadcast updates but will broadcast them after a configurable delay.
The
allowableUpdateLatencyMs
property configures how long a local update may be delayed under normal circumstances, enabling grouping with other updates. The defaultallowableUpdateLatencyMs
is 60 milliseconds but may be (1) specified during configuration of a States Workspace or Value Manager and/or (2) updated later using thecontrols
member of a Workspace or Value Manager. The States Workspace configuration applies when a Value Manager does not have its own setting.Notifications are never queued; they effectively always have an
allowableUpdateLatencyMs
of 0. However, they may be grouped with other updates that were already queued.Note that due to throttling, clients receiving updates may not see updates for all values set by another. For example, with
Latest*ValueManagers
, the only value sent is the value at the time the outgoing grouped message is sent. Previous values set by the client will not be broadcast or seen by other clients.You can configure the grouping and throttling behavior using the
allowableUpdateLatencyMs
property as in the following example:// Create and configure a states workspace const stateWorkspace = presence.getStates( "app:v1states", { // This value manager has an allowable latency of 100ms. position: Latest({ x: 0, y: 0 }, { allowableUpdateLatencyMs: 100 }), // This value manager uses the workspace default allowable latency of 60ms. count: Latest({ num: 0 }), }, // Set the default allowable latency for all value managers in this workspace to 200ms, // overriding the default value of 60ms. { allowableUpdateLatencyMs: 200 }, ); // Temporarily set count updates to send as soon as possible. const countState = stateWorkspace.props.count; countState.controls.allowableUpdateLatencyMs = 0; countState.local = { num: 5000 }; // Reset the update latency to the workspace default of 60ms. countState.controls.allowableUpdateLatencyMs = undefined;
-
Presence-related events now support the
off
event deregistration pattern (#23196) f7be9651daEvent subscriptions within
@fluidframework/presence
may now useoff
to deregister event listeners, including initial listeners provided toNotifications
.Some type names have shifted within the API though no consumers are expected to be using those types directly. The most visible rename is
NotificationSubscribable
toNotificationListenable
. Other shifts are to use types now exported through@fluidframework/core-interfaces
where the most notable isISubscribable
that is nowListenable
.
-
Presence package updates (#23021) 365c5c0643
Package scope advanced from
@fluid-experimental
(#23073)To update existing:
- package.json: replace
@fluid-experimental/presence
with@fluidframework/presence
- code imports: replace
@fluid-experimental/presence
with@fluidframework/presence/alpha
The methods and properties of
PresenceStates
have been reorganized (#23021)The
PresenceStatesEntries
object, which represents each of the states in thePresenceStates
schema, has been moved from directly withinPresenceStates
to under property namesprops
. Only theadd
method remains directly withinPresenceStates
. The typePresenceStatesMethods
has also been removed since it is no longer used.To update existing code, access your presence states from the
props
property instead of directly on thePresenceStates
object. For example:- presenceStatesWorkspace.myMap.local.get("key1"); + presenceStatesWorkspace.props.myMap.local.get("key1");
BroadcastControls
replaceLatestValueControls
(#23120)BroadcastControls
maybe specified onPresenceStates
thru newcontrols
property as defaults for all value managers.allowableUpdateLatencyMs
was renamed fromallowableUpdateLatency
to clarify units are milliseconds. Specifying this value currently has no effect, but use is recommended to light up as implementation comes online.Unsupported
forcedRefreshInterval
has been removed until implementation is closer. - package.json: replace
ISessionClient now exposes connectivity information
1. `ISessionClient` has a new method, `getConnectionStatus()`, with two possible states: `Connected` and `Disconnected`. ([#22833](https://github.com/microsoft/FluidFramework/pull/22833))
2. `ISessionClient`'s `connectionId()` member has been renamed to `getConnectionId()` for consistency. ([#22973](https://github.com/microsoft/FluidFramework/issues/22973))
3. `IPresence` event `attendeeDisconnected` is now implemented. ([#22833](https://github.com/microsoft/FluidFramework/pull/22833))
Various implementation improvements.
-
Experimental Presence package added (#22499) 42b323cdbf1
@fluid-experimental/presence is now available for investigation. The new package is meant to support presence of collaborators connected to the same container. Use this library to quickly share simple, non-persisted data among all clients or send/receive fire and forget notifications.
API documentation for @fluid-experimental/presence is available at https://fluidframework.com/docs/apis/presence.
There are some limitations; see the README.md of installed package for most relevant notes.
We're just getting started. Please give it a go and share feedback.