• Resolved net

    (@krstarica)


    1) What is the procedure for migration and transferring subscribers from OneSignal?

    2) How to display prompt after X pageviews? For OneSignal using the following code:

    jQuery(document).ready(function($) {
    
    	window.OneSignal = window.OneSignal || [];
    	var numVisitsTrigger = 3; /* Number of page visits before prompting user */
    
    	window.OneSignal.push(function() {
    		var numVisits = new Number(localStorage['numVisitsTrigger'] || 0);
    		numVisits += 1;
    		localStorage['numVisitsTrigger'] = numVisits;
    		if (numVisits >= numVisitsTrigger) {
    			promptAndSubscribeUser();
    		}
    	});
    
    	function promptAndSubscribeUser() {
    		window.OneSignal.isPushNotificationsEnabled(function(isEnabled) {
    			if (!isEnabled) {
    				// Show Slide Prompt
    				window.OneSignal.showSlidedownPrompt();
    			}
    		});
    	}
    
    });

    3) Cannot find OneSignal alternative for sending notifications to mobile apps. Wondering is it possible to integrate two plugins?

    Your plugin can detect if OneSignal’s plugin is installed:
    – If “Send notifications additionally to iOS & Android platforms” option is disabled then explain the user to remove such plugin.
    – If such option is enabled then disable their web push functionality and prompts, so your plugin displays prompts and sends web push notifications and OneSignal keeps sending mobile apps notifications.

    4) Is it possible to customize prompt to display look more like OneSignal’s:
    https://files.readme.io/94b280b-Slidedown_PrePermission_Message.png

    Many thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Perfecty

    (@perfecty)

    Hello @krstarica, thanks for contacting us.

    1) What is the procedure for migration and transferring subscribers from OneSignal?

    You need to deactivate the OneSignal plugin and activate the “Remove conflicting workers (Don’t use it with PWA/AMP)” in Perfecty Push. All the options are documented here: https://docs.perfecty.org/wp/configuration/

    2) How to display prompt after X pageviews?

    This is currently not supported. We plan to have a more advance way of asking permissions but it’s still in the roadmap.

    3) Cannot find OneSignal alternative for sending notifications to mobile apps. Wondering is it possible to integrate two plugins?

    Perfecty Push can send Web Push Notifications to the browsers that supports Web Push (Chrome,Opera,Firefox,Vivaldi,Brave) in any device. It doesn’t support iPhone/iPad and Safari in Mac.

    Unfortunately it’s not possible to integrate with OneSignal in the way you describe.

    4) Is it possible to customise prompt to display look more like OneSignal’s:

    Sure, you can see how it looks like in the Plugin Screenshots. You can customise the text and adjust the CSS yourself.

    Please let us know if you have any further questions! ??

    Thread Starter net

    (@krstarica)

    Many thanks for the prompt reply.

    1) We do have AMP pages (without PWA), is it ok to activate the “Remove conflicting workers”?

    2) Isn’t it better to target specific workers such as OneSignalSDKWorker.js instead of removing all of them?

    3) Does “Remove conflicting workers” influences subdomains? On https://www.domain.com is ok to remove OneSignal service worker, but subdomain.domain.com has its own service worker which has to remain in place.

    4) Will this procedure populate Users table with UUIDs and Endpoints from existing OneSignal’s users?

    • This reply was modified 3 years, 5 months ago by net.
    Plugin Author Perfecty

    (@perfecty)

    Hello @krstarica we will do some internal testing to confirm the outcome with AMP, however we really recommend you to try out the plugin in a test scenario before doing the actual switch. Keep in mind:

    – Your setup/themes/plugins
    – Performance and throughput requirements

    For the other questions:

    2) Isn’t it better to target specific workers such as OneSignalSDKWorker.js instead of removing all of them?

    This is difficult because we would have to have a DB of the possible existing Push Providers (OneSignal is just one of tens of them).

    3) Does “Remove conflicting workers” influences subdomains? On https://www.domain.com is ok to remove OneSignal service worker, but subdomain.domain.com has its own service worker which has to remain in place.

    It shouldn’t affect, web workers are per origin and the subdomains are different origins.

    4) Will this procedure populate Users table with UUIDs and Endpoints from existing OneSignal’s users?`

    Yes, it will automatically re-register the users that have already provided Browser Notifications permissions to your website.

    Thread Starter net

    (@krstarica)

    Many thanks for your replies.

    Wondering how long does it take to send 10,000 notifications?

    We have define('DISABLE_WP_CRON', true); and /wp-cron.php?doing_wp_cron triggering every 5 minutes.

    Since default Batch Size is 30, does it mean it will take (10,000 / 30) * 5 = 1667 minutes?

    Plugin Author Perfecty

    (@perfecty)

    11,390 notifications are sent in about 20 min in a real production website without any impact on the server, having WP Cron enabled (not disabled as you), a batch size of 100, and the server is a DigitalOcean Basic Droplet / 2 GB RAM / 1 Shared vCPU. Currently, we’re fine with those numbers, specially because the server load doesn’t increase that much. So far, we’ve sent around 586,484 notifications in total and we’re very happy with it ??

    In case we need to increase the performance, we still have room to do it (by implementing parallel jobs, or adjusting the batch size, or hardware specs, etc).

    Thread Starter net

    (@krstarica)

    11,390 notifications in 20 minutes = 9 notifications per second.

    How does OneSignal send 10,000 notifications in less than a minute = 166 notifications per second?

    What “batch size” controls? Is that number of requests to endpoints?

    Are we grouping them? For example, I see FCM has limit of 500 messages per request: https://firebase.google.com/docs/cloud-messaging/send-message

    Plugin Author Perfecty

    (@perfecty)

    How does OneSignal send 10,000 notifications in less than a minute = 166 notifications per second?

    You can’t compare a Basic Droplet server with 1 Shared vCPU against OneSignal’s entire infrastructure. If you want to do that, you should start by replacing PHP with Rust as OneSignal does, and scale the servers.

    What “batch size” controls? Is that number of requests to endpoints?

    Batch size define the number of notifications send by a WP job. A notification job runs multiple consecutive WP jobs, and each WP job sends “X batch size” notifications. This is configurable so basically it depends on you and your server characteristics.

    As we said, we still have room to improve performance but at the end it will depend on your own infrastructure, naturally because this is self-hosted. Some questions to understand your use case:

    – What is an acceptable time for your use case?
    – How big is your server in terms of CPU/Memory?
    – How many notifications are you planning to send?

    Thread Starter net

    (@krstarica)

    Would like to send 10,000 notifications on E5-2670v3 CPU with 128 GB RAM in less than a minute.

    If theoretically all of them are sent using FCM, we could do it in 20 requests, each sending 500 notifications (FCM doc: “The REST API and the Admin FCM APIs allow you to multicast a message to a list of device registration tokens. You can specify up to 500 device registration tokens per invocation.”).

    That can be done in 60 seconds (with 3 seconds sleep between each request).

    If this currently takes 20 minutes, that means grouping is not in place and we actually need to make 10,000 requests?

    Plugin Author Perfecty

    (@perfecty)

    OK, that’s an interesting use case and we would love to assist you on getting those numbers ??

    As far as we know the push library we use doesn’t do grouping, however that would be an interesting thing to check and potentially implement if it’s possible.

    Another thing to note is that WP Crons are activated usually per page visit, so if the WP Cron that executes a single batch has finished, there’s a dead spot in which we lose some seconds. For 10.000 notifications in batches of 100, it’s 100 cycles, it means that if we wait 1 second between cycle, we lose 1,6 min, for 2 seconds we lose 3.3 min, etc… As we said, there’s definitively room for improvement, e.g. one alternative would be to have a script with no execution limit and we can send everything in one single cycle.

    Thread Starter net

    (@krstarica)

    Right, there are two issues to address:

    1) Multicast support in push library. This seems related:
    https://github.com/web-push-libs/web-push-php/issues/104

    2) Support for a script with no execution limit.

    Or to add an option to use Firebase Cloud Messaging or similar free platform to handle push notifications. Then we don’t have to think about throttling nor CPU power and we can send 10.000 notifications in less than a minute straight away.

    Plugin Author Perfecty

    (@perfecty)

    The original request items have been included in v1.3.1. In regards to the performance improvements there’s a ticket for it already in Github, so please follow the one from Github: https://github.com/perfectyorg/perfecty-push-wp/issues/81

    Thread Starter net

    (@krstarica)

    @perfecty many thanks for implementing a bunch of suggestions.

    Never seen anyone responding and taking action so fast and actually implementing suggestions and listening to the feedback.

    Plugin Author Perfecty

    (@perfecty)

    Hello, the speed improvements have been released in v1.4.0. It’s now 2300% faster. It can now perfectly send more than 10.000 in less than 50 seconds. We recommend you to look at: https://docs.perfecty.org/wp/performance-improvements/#example

    Thank you,

    Perfecty Team

    Thread Starter net

    (@krstarica)

    Wow, that’s fantastic improvement!

    The only way to test that number is in production, so we need to remove OneSignal’s service worker. If something fails, we cannot go back?

    Plugin Author Perfecty

    (@perfecty)

    Yes, you can go back of course. We can still discuss the details so if needed contact us at https://perfecty.org/contact

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘OneSignal’ is closed to new replies.