Skip to content

Commit

Permalink
Enabling session multiplexing by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Jun 20, 2023
1 parent f2a8905 commit 2b4a133
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
* Upgraded Realm Core from v13.10.1 to v13.11.0. ([#5811](https://github.com/realm/realm-js/issues/5811))
* Bump sync protocol to v9 to indicate client has fix for client reset error during async open. ([realm/realm-core#6609](https://github.com/realm/realm-core/issues/6609))
* Aligning analytics with other Realm SDKs. You can still disable the submission by setting environment variable `REALM_DISABLE_ANALYTICS`, and you can print out what is submitted by setting the environment variable `REALM_PRINT_ANALYTICS`.
* Disabling sync session multiplexing by default in the SDK, since Core's default changed to enabled with v13.11.0. ([#5831](https://github.com/realm/realm-js/pull/5831))
* Enabling sync session multiplexing by default in the SDK. ([#5831](https://github.com/realm/realm-js/pull/5831) & [#5912](https://github.com/realm/realm-js/pull/5912))
* Applied use of an opt-in list for Bindgen. ([#5820](https://github.com/realm/realm-js/pull/5820))
* Upgraded Realm Core from v13.11.1 to v13.15.1. ([#5873](https://github.com/realm/realm-js/pull/5873) & [#5909](https://github.com/realm/realm-js/pull/5909))

Expand Down
1 change: 1 addition & 0 deletions packages/realm/bindgen/js_opt_in_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ records:
- base_file_path
- metadata_mode
- user_agent_binding_info
- multiplex_sessions

SyncError:
fields:
Expand Down
12 changes: 9 additions & 3 deletions packages/realm/src/app-services/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export type AppConfiguration = {
* The timeout for requests (in milliseconds)
*/
timeout?: number;

/**
* Use the same underlying connection towards the server across multiple sync sessions.
* This use less resources on the server and provide a small increase in speed when opening subsequent synced Realms.
* @default true
*/
multiplexSessions?: boolean;
};

/**
Expand Down Expand Up @@ -177,7 +184,7 @@ export class App<FunctionsFactoryType = DefaultFunctionsFactory, CustomDataType
constructor(configOrId: AppConfiguration | string) {
const config: AppConfiguration = typeof configOrId === "string" ? { id: configOrId } : configOrId;
assert.object(config, "config");
const { id, baseUrl, app, timeout } = config;
const { id, baseUrl, app, timeout, multiplexSessions = true } = config;
assert.string(id, "id");
if (timeout !== undefined) {
assert.number(timeout, "timeout");
Expand All @@ -197,8 +204,7 @@ export class App<FunctionsFactoryType = DefaultFunctionsFactory, CustomDataType
baseFilePath: fs.getDefaultDirectoryPath(),
metadataMode: binding.MetadataMode.NoEncryption,
userAgentBindingInfo: App.userAgent,
// Default session multiplexing to being disabled.
multiplexSessions: false,
multiplexSessions,
},
);
}
Expand Down

0 comments on commit 2b4a133

Please sign in to comment.