Skip to content

Commit

Permalink
build(client): publish experimental presence (#22499)
Browse files Browse the repository at this point in the history
+ Note current Notifications limitation
+ Connect docs to readme with more details
  • Loading branch information
jason-ha authored Sep 16, 2024
1 parent 709f085 commit 42b323c
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .changeset/moody-rats-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@fluid-experimental/presence": major
---
---
"section": feature
---

Experimental Presence package added

**[@fluid-experimental/presence](https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme)** 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.
1 change: 1 addition & 0 deletions feeds/internal-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@fluidframework/undo-redo
@fluidframework/synthesize
@fluidframework/request-handler
@fluid-experimental/presence
@fluid-experimental/oldest-client-observer
@fluidframework/fluid-static
fluid-framework
Expand Down
1 change: 1 addition & 0 deletions feeds/internal-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@fluidframework/undo-redo
@fluidframework/synthesize
@fluidframework/request-handler
@fluid-experimental/presence
@fluid-experimental/oldest-client-observer
@fluidframework/fluid-static
fluid-framework
Expand Down
1 change: 1 addition & 0 deletions feeds/public.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@fluidframework/undo-redo
@fluidframework/synthesize
@fluidframework/request-handler
@fluid-experimental/presence
@fluid-experimental/oldest-client-observer
@fluidframework/fluid-static
fluid-framework
Expand Down
2 changes: 2 additions & 0 deletions fluidBuild.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ module.exports = {
"^examples/data-objects/table-document/",
// AB#8147: ./test/EditLog export should be ./internal/... or tagged for support
"^experimental/dds/tree/",
// comments in api-extractor JSON files fail parsing - PR #22498 to fix
"^packages/framework/presence/",

// Packages with APIs that don't need strict API linting
"^build-tools/",
Expand Down
11 changes: 11 additions & 0 deletions packages/framework/presence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const presence = await acquirePresenceViaDataObject(container.initialObjects.pre

## Limitations

### States Reliability

The current implementation relies on Fluid Framework's Signal infrastructure instead of Ops. This has advantages, but comes with some risk of unreliable messaging. The most common known case of unreliable signals occurs during reconnection periods and current implementation attempts to account for that. Be aware that all clients are not guaranteed to arrive at eventual consistency. Please [file a new issue](https://github.com/microsoft/FluidFramework/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Presence:%20States:%20) if one is not found under [Presence States issues](https://github.com/microsoft/FluidFramework/issues?q=is%3Aissue+%22Presence%3A+States%3A%22).

### Compatibility and Versioning

Current API does not provide a mechanism to validate that state and notification data received within session from other clients matches the types declared. The schema of workspace address, states and notifications names, and their types will only be consistent when all clients connected to the session are using the same types for a unique value/notification path (workspace address + name within workspace). In other words, don't mix versions or make sure to change identifiers when changing types in a non-compatible way.
Expand All @@ -82,6 +86,13 @@ presence.getStates("app:v1states", { myState2: Latest({x: true})});
would be compatible with both of the prior schemas as "myState2" is a different name. Though in this situation none of the different clients would be able to observe each other.


### Notifications

Notifications API is mostly unimplemented. All messages are always broadcast even if `unicast` API is used and all are emitted as `unattendedNotification` event rather than the appropriate custom event.

Notifications are fundamentally unreliable at this time as there are no built-in acknowledgements nor retained state. To prevent most common loss of notifications, always check for connection before sending.


### Experimental

<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE) -->
Expand Down
1 change: 0 additions & 1 deletion packages/framework/presence/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@fluid-experimental/presence",
"version": "2.3.0",
"private": true,
"description": "A component for lightweight data sharing within a single session",
"homepage": "https://fluidframework.com",
"repository": {
Expand Down
3 changes: 3 additions & 0 deletions packages/framework/presence/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

/**
* Experimental package for client presence within a connected session.
*
* See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.
*
* @packageDocumentation
*/

Expand Down

0 comments on commit 42b323c

Please sign in to comment.