Cobrowse.io Docs
  • Getting started
  • SDK Installation
    • Web
    • iOS
    • Android
    • React Native
    • Flutter
    • .NET Mobile
    • macOS
    • Windows
  • SDK Features
    • Account config
    • Identify your devices
    • Use 6-digit codes
    • Redact sensitive data
    • Viewing PDFs
    • Universal Cobrowse
    • Customize the interface
      • Active session controls
      • 6-digit code screen
      • User consent dialog
      • Remote control consent dialog
      • Full device consent dialog
      • Localization / translation
    • Initiate sessions with push
    • Listening for events
    • Full device capabilities
      • Full device screen sharing
      • Full device remote control
      • Managing full device mode
    • Advanced configuration
      • Starting and stopping the SDK
      • Declaring capabilities
      • Intercepting mobile SDK network requests
      • Web
        • IFrames support
        • IE 11 polyfills
        • Cross-domain session support
        • Ignore Views
      • iOS
        • Alternate render method
        • Custom touch handling
      • Android
        • Backporting TLS to older Android versions
  • Agent-side integrations
    • Agent-side overview
    • Platform integrations
      • Zendesk
      • Salesforce
        • Migrating from legacy to v2
        • Salesforce (Legacy)
      • Genesys
        • Genesys Cloud
        • Engage Workspace Web Edition (WWE)
        • Engage Workspace Desktop Edition (WDE)
      • Intercom
      • Freshworks
      • Talkdesk
      • NICE
    • Custom integrations
    • Agent SDK
      • API Reference
      • Sample code snippets
    • Authentication (JWTs)
      • JWT Policies
    • Authentication (SAML 2.0)
    • IFrame embeds
  • Enterprise self-hosting
    • Self-hosting overview
    • Docker Compose
    • Helm chart
      • Image Pull Secret
      • Environment Variables
      • Optional recording components
      • Pod Annotations
    • AWS terraform
      • AWS metrics configuration
    • Azure terraform
      • Azure metrics configuration
    • GCP terraform
      • GCP metrics configuration
    • Sizing guidelines
    • Running your instance
      • Adding a superuser
      • Limiting account creation
      • Limiting magic link recipients
      • Configuring SMTP
      • Managing your deployment
    • Monitoring your instance
      • Available metrics
      • Self-Hosted Prometheus
    • Advanced configuration
      • Air gap configuration
      • Pin web SDK version
      • L7 firewall configuration
      • Docker proxy configuration
    • Troubleshooting
Powered by GitBook
On this page
  • Starting the SDK
  • Automatic registration
  • Stopping the SDK

Was this helpful?

  1. SDK Features
  2. Advanced configuration

Starting and stopping the SDK

Have greater control over when the SDK is running.

PreviousAdvanced configurationNextDeclaring capabilities

Last updated 3 months ago

Was this helpful?

Starting the Cobrowse SDK is often done early in your application. However, you have the ability to delay the start of the SDK or programmatically stop the SDK so that it runs only when needed.

Starting the SDK

await CobrowseIO.client();
await CobrowseIO.start();

Advanced usage

Sometimes it is required to run Cobrowse.io only within an IFrame, and not any containing or parent page. This is supported, but requires passing an extra configuration option when starting Cobrowse. Most implementations should not need to use this. Please contact us if you are unsure.

await CobrowseIO.start({ allowIFrameStart: true });

Swift

CobrowseIO.instance().start()

Objective-C

[CobrowseIO.instance start];
CobrowseIO.instance().start();
CobrowseIO.start();
CobrowseIO.instance.start();
CobrowseIO.Instance.Start();
await CobrowseIO.Instance.Start();

If you do decide to delay or lazy load the SDK it is important to check if there is a currently active session and if so load and start the SDK right away. Without this check sessions would not continue between navigation or page refreshes as the SDK won't be loaded.

// On page load check if we should start the Cobrowse SDK right away
if (CobrowseIO.currrentSession) {
  await CobrowseIO.client();
  await CobrowseIO.start();
}

See a full example with the Web SDK in

Automatic registration

By default, when the SDK starts it will register the device to your account and share its connectivity state. This provides the dashboard with a list of devices which are online and ready to connect.

If you don't need to see a list of devices in your dashboard, e.g. your sessions start only using , then you can stop the SDK from registering the device and its connectivity status by setting the registration option with a value of false.

CobrowseIO.registration = false;
CobrowseIO.instance.registration = NO;
CobrowseIO.instance().registration(false);
CobrowseIO.instance.setRegistration(false);
CobrowseIO.Instance.Registration = false;
CobrowseIO.Instance.Registration = false;

Stopping the SDK

Calling stop() will stop Cobrowse completely and you won't be able to Cobrowse again until you call start(). If you only wish to end a session please use end() method on the Session object.

await CobrowseIO.stop();

Swift

CobrowseIO.instance().stop()

Objective-C

[CobrowseIO.instance stop];
CobrowseIO.instance().stop();
CobrowseIO.stop();
CobrowseIO.instance.stop();
CobrowseIO.Instance.Stop();
CobrowseIO.Instance.Stop();
https://github.com/cobrowseio/cobrowse-sdk-js-examples?tab=readme-ov-file#standalone-support-code-with-delayed-sdk-start-example
6-digit codes