Skip to content

What happens if ...?

Jason Pang edited this page Nov 21, 2016 · 31 revisions

What happens if you switch to HTTPS from a single app (keeping the same app)?

The user's client-side IndexedDb data and push subscription will no longer exist, since the HTTPS site is a different origin. A new user entry will be created for the user, in the same OneSignal app, since there is no user with an existing subscription that matches the newly obtained subscription after the user subscribes.

What happens if you change the app ID?

The SDK no longer automatically unsubscribes or modifies IndexedDB data when an App ID is detected to be different from before. This behavior was dangerous, so it was removed.

Instead, for existing users, the user will receive a new user ID, since users are registered on every new session, and the registration now occurs on a different app ID, so OneSignal will create a new user ID since it isn't able to find a previous user with the provided registration token.

The user will keep the same registration token and the same push subscription. This means that for non-working subscriptions, it will not be fixed by creating a new app.

For upgrades from HTTP to HTTPS, the change of origin automatically wipes out all IndexedDB data and push subscription, so users upgrading from HTTP to HTTPS only need to use a new app ID.

Note: In a future SDK update, I think it'd be great if all data could be segmented by app ID, so that switching between app IDs gives users a fresh start (in line with what you'd expect by creating a new app) without erasing previous data tied to a different app ID. Currently, our IndexedDB database only stores one set of information regardless of the app ID.

When do we get an unsubscription event from Google?

Clearing Cookies and other site and plugin data after subscribing, and sending another message

Environment: Chrome 54.0.2840.87 (64-bit) on Mac OS X 10.11.6

Revision: c5ec6c5a12f2ed748bb08c1a8567b3c0df89dccd-refs/branch-heads/2840@{#805}

  1. Subscribe.
  2. Close the tab you subscribed on.
  3. Clear Cookies and other site and plugin data (Settings -> Privacy -> Clear Browsing Data...).
  4. Send yourself a notification.
  5. Observe delivery results are okay.
  6. Send yourself another notification.
  7. Observe delivery results mark you as unsubscribed.

Do we get a unsubscription event right after the first message delivery?

No. It looks like the browser sends an unregistration message though:

Do we get an unsubscription event right after the second message delivery?

Yes. Google immediately tells us the user is no longer subscribed. The browser's chrome://gcm-internals does not record any message received.

Note 1: It looks like clearing Cookies and other site and plugin data is the only setting necessary in clearing browser data to unsubscribe the user (all the other clearing options are unrelated).

Note 2: This method of clearing data also unregisters the service worker itself which means the entry in chrome://serviceworker-internals is missing.