You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,8 @@ default, ShareDB stores all operations forever - nothing is truly deleted.
76
76
77
77
## User presence synchronization
78
78
79
+
ShareDB supports synchronization of user presence data. This feature is opt-in, not enabled by default. To enable this feature, pass the `enablePresence: true` option to the ShareDB constructor (e.g. `var share = new ShareDB({ enablePresence: true })`).
80
+
79
81
Presence data represents a user and is automatically synchronized between all clients subscribed to the same document. Its format is defined by the document's [OT Type](https://github.com/ottypes/docs), for example it may contain a user ID and a cursor position in a text document. All clients can modify their own presence data and receive a read-only version of other client's data. Presence data is automatically cleared when a client unsubscribes from the document or disconnects. It is also automatically transformed against applied operations, so that it still makes sense in the context of a modified document, for example a cursor position may be automatically advanced when a user types at the beginning of a text document.
80
82
81
83
## Server API
@@ -96,6 +98,8 @@ __Options__
96
98
*`options.pubsub`_(instance of `ShareDB.PubSub`)_
97
99
Notify other ShareDB processes when data changes
98
100
through this pub/sub adapter. Defaults to `ShareDB.MemoryPubSub()`.
101
+
*`options.enablePresence`_(optional boolean)_
102
+
Enable user presence synchronization.
99
103
100
104
#### Database Adapters
101
105
*`ShareDB.MemoryDB`, backed by a non-persistent database with no queries
0 commit comments