diff --git a/source/sdk/dotnet/app-services/connect-to-app-services-backend.txt b/source/sdk/dotnet/app-services/connect-to-app-services-backend.txt index 4f81bfd9f2..a0ff22b4c5 100644 --- a/source/sdk/dotnet/app-services/connect-to-app-services-backend.txt +++ b/source/sdk/dotnet/app-services/connect-to-app-services-backend.txt @@ -50,68 +50,3 @@ method. The following example sets the LogLevel and the request timeout: You can create multiple App client instances to connect to multiple Apps. All App client instances that share the same App ID use the same underlying connection. - -.. _dotnet-connect-to-specific-server: - -Connect to a Specific Server ----------------------------- - -By default, Atlas Device SDK connects to Atlas using the global ``baseURL`` -of ``https://services.cloud.mongodb.com``. In some cases, you may want to -connect to a different server: - -- Your App Services App uses :ref:`local deployment `, and - you want to connect directly to a local ``baseURL`` in your region. - -You can specify a ``baseURL`` in the -:dotnet-sdk:`AppConfiguration `. - -.. literalinclude:: /examples/generated/dotnet/BaseURLChange.snippet.custom-base-url.cs - :language: csharp - -Connect to a Different Server During Runtime -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 12.1.0 - -In some cases, you might want to change the ``baseURL`` while the app is -running. To change -the ``baseURL`` during runtime, call the -:dotnet-sdk:`app.UpdateBaseUriAsync() ` -method: - -.. literalinclude:: /examples/generated/dotnet/BaseURLChange.snippet.update-base-url.cs - :language: csharp - -This API is experimental. As seen above, you must use ``#pragma warning disable Rlm001`` -and ``#pragma warning restore Rlm001`` to suppress the experimental errors, -where ``Rlm001`` is the experimental attributes's ``diagnosticId``. - -If you want to change the ``baseURL`` after you have logged in a user and -have opened a synced database, the app must perform a -:ref:`client reset `. Perform these steps in your code: - -1. :ref:`Pause the Sync session `. -2. Update the ``baseURL`` by calling the ``app.updateBaseUrl(to: )`` method. -3. Authenticate and log the user in again with the new ``baseURL``. -4. Open a synced database pulling data from the new server. - -Both the server and the client must be online for the user to authenticate and -connect to the new server. If the server is not online or the client does not -have a network connection, the user cannot authenticate and open the database. - -.. important:: Changing an App Config After Initializing the App - - .. versionchanged:: v11.7.0 - ``BaseUri`` is not cached in the App configuration - - When you initialize the App client, the configuration is cached internally. - Attempting to close and then re-open an App with a changed configuration - within the same process has no effect. The client continues to use the - cached configuration. - - In .NET SDK version 11.7.0 and later, the :dotnet-sdk:`BaseUri ` - is *no longer* cached in the App configuration. This means that you can change the - ``BaseUri``, and the App client will use the updated configuration. In - earlier SDK versions, changes to the ``BaseUri`` in a cached App - configuration have no effect. diff --git a/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt b/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt index c0389497f0..4e355b9954 100644 --- a/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt +++ b/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt @@ -261,54 +261,6 @@ method, which accepts a Boolean value. This feature is currently only available on Android and Java Virtual Machine (JVM) platforms. -.. _kotlin-connect-to-specific-server: - -Connect to a Specific Server ----------------------------- - -By default, Atlas Device SDK connects to Atlas using the global ``baseUrl`` -of ``https://services.cloud.mongodb.com``. In some cases, you may want to -connect to a different server: - -- Your App Services App uses local deployment, and you want to connect directly to a local ``baseUrl`` in your region. -For more information, refer to the :ref:`` App Services documentation. - -You can specify a ``baseUrl`` in the -`AppConfiguration <{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-app-configuration/index.html>`__: - -.. literalinclude:: /examples/generated/kotlin/AppClientTest.snippet.custom-base-url.kt - :language: kotlin - -Connect to a Different Server During Runtime -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 1.16.0 - -In some cases, you might want to change the ``baseUrl`` while the app is -running. - -To change the ``baseUrl`` during runtime, call the experimental -`app.updateBaseUrl <{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-app/index.html#2007791704%2FFunctions%2F380376748>`__ method. You can -pass ``null`` to reset the ``baseUrl`` to the default value. - -.. literalinclude:: /examples/generated/kotlin/AppClientTest.snippet.change-base-url.kt - :language: kotlin - -If you change the ``baseUrl`` *after* you have logged in a user and -have opened a synced database, the app must perform a client reset. For more -information, refer to :ref:`kotlin-client-reset`. - -Perform the following in your code: - -1. :ref:`Pause the Sync session ` -2. Update the ``baseUrl`` using the ``app.updateBaseUrl`` method -3. Re-authenticate the user to log in using the new ``baseUrl`` -4. Open a synced database pulling data from the new server - -Both the server and the client *must* be online for the user to authenticate and -connect to the new server. If the server is not online or the client does not -have a network connection, the user cannot authenticate and open the database. - Close the App Client -------------------- diff --git a/source/sdk/node/app-services/connect-to-app-services-backend.txt b/source/sdk/node/app-services/connect-to-app-services-backend.txt index 3b68d9f8d7..e966f9baa3 100644 --- a/source/sdk/node/app-services/connect-to-app-services-backend.txt +++ b/source/sdk/node/app-services/connect-to-app-services-backend.txt @@ -139,98 +139,3 @@ To encrypt App metadata: :tabid: javascript .. include:: /examples/generated/node/v12/formatted/metadata.test.snippet.encrypt-metadata.js.rst - -Connect to a Specific Server ----------------------------- - -By default, Atlas Device SDK connects to Atlas using the global ``baseURL`` -of ``https://services.cloud.mongodb.com``. In some cases, you may want to -connect to a different server: - -- Your App Services App uses :ref:`local deployment `, and - you want to connect directly to a local ``baseURL`` in your region. - -You can specify a ``baseURL`` in the -:js-sdk:`AppConfiguration `: - -.. tabs-realm-languages:: - - .. tab:: - :tabid: typescript - - .. literalinclude:: /examples/generated/node/v12/formatted/app-services.test.snippet.custom-base-url.ts.rst - :language: typescript - - .. tab:: - :tabid: javascript - - .. literalinclude:: /examples/generated/node/v12/formatted/app-services.test.snippet.custom-base-url.js.rst - :language: javascript - -.. _node-change-server-during-runtime: - -Connect to a Different Server During Runtime -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 12.8.0 - -In some cases, you might want to change the ``baseURL`` while the app is -running. - -To change the ``baseURL`` during runtime, call the ``app.updateBaseUrl()`` -method. Note that the string value can't end in a trailing slash. - -.. tabs-realm-languages:: - - .. tab:: - :tabid: typescript - - .. include:: /examples/generated/node/v12/formatted/app-services.test.snippet.change-base-url.ts.rst - - .. tab:: - :tabid: javascript - - .. include:: /examples/generated/node/v12/formatted/app-services.test.snippet.change-base-url.js.rst - -This API is experimental, so you must use the experimental import in the file -where you want to use this API: - -.. include:: /examples/generated/node/v12/formatted/app-services.test.snippet.import-experimental-baseurl.ts.rst - -.. _node-change-server-typescript: - -TypeScript Config for Experimental API -`````````````````````````````````````` - -The ``app.updateBaseUrl()`` method is in an experimental module that you must -import separately. To get the proper types from this module, you need to set the -following fields in your ``tsconfig.json`` file: - -.. code-block:: json - :copyable: true - - { - "target": "es2022", - "module": "node16", - "moduleResolution": "node16", - // ... - } - - -Change Server with Logged-in User -````````````````````````````````` - -If you want to change the ``baseURL`` after you have logged in a user and -have opened a synced database, the app must perform a -:ref:`client reset `. Perform these steps in your -code: - -1. :ref:`Pause the Sync session `. -2. Update the ``baseURL`` by calling the ``app.updateBaseUrl()`` method. -3. Go through the authentication flow again to log in the user through the - new ``baseURL``. -4. Open a synced database pulling data from the new server. - -Both the server and the client must be online for the user to authenticate and -connect to the new server. If the server is not online or the client does not -have a network connection, the user cannot authenticate and open the database. diff --git a/source/sdk/react-native/app-services/connect-to-app-services-app.txt b/source/sdk/react-native/app-services/connect-to-app-services-app.txt index cae1eccec8..784686920d 100644 --- a/source/sdk/react-native/app-services/connect-to-app-services-app.txt +++ b/source/sdk/react-native/app-services/connect-to-app-services-app.txt @@ -96,30 +96,3 @@ To encrypt App metadata: #. Pass the App configuration object to ``new Realm.App()``. .. include:: /examples/generated/react-native/v12/EncryptMetadata.snippet.encrypt-metadata.tsx.rst - -Connect to a Specific Server ----------------------------- - -By default, Atlas Device SDK connects to Atlas using the global ``baseURL`` -of ``https://services.cloud.mongodb.com``. In some cases, you may want to -connect to a different server: - -- Your App Services App uses :ref:`local deployment `, and - you want to connect directly to a local ``baseURL`` in your region. - -You can specify a ``baseURL`` as a prop for :ref:`AppProvider `. -All :js-sdk:`AppConfiguration ` keys can be -passed as props to ``AppProvider``. - -Connect to a Different Server During Runtime -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionchanged:: ``realm@12.8.0`` - -In some cases, you might want to change the ``baseURL`` while the app is -running. - -Currently, this feature is implemented as an experimental module that requires -specific TypeScript configuration. The required configuration can be difficult -to make work with a React Native app. For more information on implementation, refer to :ref:`documentation for the -Node.js SDK `. diff --git a/source/sdk/swift/app-services/connect-to-app-services-backend.txt b/source/sdk/swift/app-services/connect-to-app-services-backend.txt index a09b410b02..b5a549444b 100644 --- a/source/sdk/swift/app-services/connect-to-app-services-backend.txt +++ b/source/sdk/swift/app-services/connect-to-app-services-backend.txt @@ -104,55 +104,6 @@ refer to :objc-sdk:`RLMSyncTimeoutOptions `. .. literalinclude:: /examples/generated/code/start/RealmApp.snippet.app-config-sync-timeout.swift :language: swift -.. _swift-connect-to-specific-server: - -Connect to a Specific Server ----------------------------- - -By default, Atlas Device SDK connects to Atlas using the global ``baseURL`` -of ``https://services.cloud.mongodb.com``. In some cases, you may want to -connect to a different server: - -- Your App Services App uses :ref:`local deployment `, and - you want to connect directly to a local ``baseURL`` in your region. - -You can specify a ``baseURL`` in the -:swift-sdk:`AppConfiguration `: - -.. literalinclude:: /examples/generated/code/start/RealmApp.snippet.custom-base-url.swift - :language: swift - -Connect to a Different Server During Runtime -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 10.50.0 - -In some cases, you might want to change the ``baseURL`` while the app is -running. To change -the ``baseURL`` during runtime, call the ``app.updateBaseUrl(to: )`` method: - -.. literalinclude:: /examples/generated/code/start/RealmApp.snippet.change-base-url.swift - :language: swift - -This API is experimental, so you must use the experimental import in the file -where you want to use this API: - -.. literalinclude:: /examples/generated/code/start/RealmApp.snippet.import-experimental.swift - :language: swift - -If you want to change the ``baseURL`` after you have logged in a user and -have opened a synced database, the app must perform a -:ref:`client reset `. Perform these steps in your code: - -1. :ref:`Pause the Sync session `. -2. Update the ``baseURL`` by calling the ``app.updateBaseUrl(to: )`` method. -3. Authenticate and log the user in again with the new ``baseURL``. -4. Open a synced database pulling data from the new server. - -Both the server and the client must be online for the user to authenticate and -connect to the new server. If the server is not online or the client does not -have a network connection, the user cannot authenticate and open the database. - Supported Operating Systems ---------------------------