Skip to content

Commit e3e9d43

Browse files
Update Yorkie version to 0.4.17 (#123)
Co-authored-by: Youngteac Hong <susukang98@gmail.com>
1 parent 63f38fe commit e3e9d43

File tree

4 files changed

+31
-41
lines changed

4 files changed

+31
-41
lines changed

.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Common Environment Variables
2-
NEXT_PUBLIC_YORKIE_VERSION='0.4.13'
3-
NEXT_PUBLIC_YORKIE_JS_VERSION='0.4.13'
4-
NEXT_PUBLIC_YORKIE_IOS_VERSION='0.4.7'
5-
NEXT_PUBLIC_YORKIE_ANDROID_VERSION='0.4.7'
2+
NEXT_PUBLIC_YORKIE_VERSION='0.4.17'
3+
NEXT_PUBLIC_YORKIE_JS_VERSION='0.4.17'
4+
NEXT_PUBLIC_YORKIE_IOS_VERSION='0.4.17'
5+
NEXT_PUBLIC_YORKIE_ANDROID_VERSION='0.4.16'
66
NEXT_PUBLIC_DASHBOARD_PATH='/dashboard'
77
NEXT_PUBLIC_JS_SDK_URL='https://cdnjs.cloudflare.com/ajax/libs/yorkie-js-sdk/0.4.13/yorkie-js-sdk.js'
88

docs/js-sdk.mdx

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ This ensures that any modifications made by one client are instantly propagated
7272

7373
The second argument is options.
7474
- `initialPresence`: Sets the initial presence of the client that attaches the document. The presence is shared with other users participating in the document. It must be serializable to JSON.
75-
- `isRealtimeSync`(Optional): Specifies whether to enable real-time synchronization. The default value is `true`, which means synchronization occurs automatically. If set to `false`, you should manually control the synchronization.
75+
- `syncMode`(Optional): Specifies synchronization modes. The default value is `SyncMode.Realtime`, which automatically pushes and pulls changes. If you set it to `SyncMode.Manual`, you'll need to manually handle synchronization.
7676

7777
```javascript
7878
await client.attach(doc, {
7979
initialPresence: { color: 'blue', cursor: { x: 0, y: 0 } },
80-
isRealtimeSync: true,
80+
syncMode: SyncMode.Manual,
8181
});
8282
```
8383

@@ -299,43 +299,33 @@ const unsubscribe = doc.subscribe('$.todos', (event) => {
299299
});
300300
```
301301

302-
#### Changing Synchronization Setting
302+
#### Changing Synchronization Mode
303303

304-
To change the synchronization setting for a document, you can use `client.pause(doc)` and `client.resume(doc)`.
304+
To change the synchronization mode for a document, you can use `client.changeSyncMode(doc, syncMode)`.
305305

306-
When you pause a document, the synchronization process will no longer occur in realtime, and you will need to manually execute the synchronization to ensure that the changes are propagated to other clients.
306+
Yorkie offers four SyncModes:
307307

308-
To resume the realtime synchronization, you can call `client.resume(doc)`.
308+
- `SyncMode.Realtime`: Local changes are automatically pushed to the server, and remote changes are pulled from the server.
309309

310-
```javascript
311-
// 1. Pause real-time sync
312-
await client.pause(doc);
313-
await client.sync(doc); // To perform synchronization, you need to manually call the sync function
310+
- `SyncMode.RealtimePushOnly`: Only local changes are pushed, and remote changes are not pulled.
314311

315-
// 2. Resume real-time sync
316-
await client.resume(doc);
317-
```
312+
- `SyncMode.RealtimeSyncOff`: Changes are not synchronized, but the watch stream remains active.
318313

319-
#### Changing Synchronization Mode
314+
- `SyncMode.Manual`: Synchronization no longer occurs in real-time, and the watch stream is disconneted. Manual handling is required for synchronization.
320315

321-
By default, Yorkie synchronizes a document in `push-pull` mode, where local changes are pushed to the server, and remote changes are pulled from the server.
322-
323-
If you only want to send your changes and not receive remote changes, you can use `push-only` mode.
316+
```javascript
317+
// Enable automatic synchronization of both local and remote changes.
318+
await client.changeSyncMode(doc, SyncMode.Realtime);
324319

325-
For realtime synchronization, you can use `client.pauseRemoteChanges(doc)` and `client.resumeRemoteChanges(doc)`.
320+
// Only push local changes automatically.
321+
await client.changeSyncMode(doc, SyncMode.RealtimePushOnly);
326322

327-
For manual synchronization, you can pass the desired sync mode to `client.sync(doc, syncMode)`.
323+
// Synchronization turned off, but the watch stream remains active.
324+
await client.changeSyncMode(doc, SyncMode.RealtimeSyncOff);
328325

329-
```javascript
330-
// Pause remote changes for realtime sync
331-
client.pauseRemoteChanges(doc);
332-
// Resume remote changes for realtime sync
333-
client.resumeRemoteChanges(doc);
334-
335-
// Manual sync in Push-Only mode
336-
await client.sync(doc, SyncMode.PushOnly);
337-
// Manual sync in Push-Pull mode
338-
await client.sync(doc, SyncMode.PushPull);
326+
// Synchronization turned off, and the watch stream is disconneted.
327+
await client.changeSyncMode(doc, SyncMode.Manual);
328+
await client.sync(doc); // Trigger synchronization manually using the sync function.
339329
```
340330

341331
#### Detaching the Document

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"rehype-slug": "^5.1.0",
3434
"remark-gfm": "^3.0.1",
3535
"unist-util-visit": "^4.1.1",
36-
"yorkie-js-sdk": "^0.4.12"
36+
"yorkie-js-sdk": "^0.4.17"
3737
},
3838
"devDependencies": {
3939
"@mdx-js/loader": "^2.1.5",

0 commit comments

Comments
 (0)