question

aonosomo000 avatar image
aonosomo000 asked

[node.js] How can I send push notification to massive users?,[node.js] How can I send push notification to massive users?

First, I typed code that send push notification to players in all user segment.

const serverWorker = require('./node_modules/playfab-sdk/Scripts/PlayFab/PlayFabServer');

while (counts < 10000) {
    try {
        serverWorker.SendPushNotification({
            AdvancedPlatformDelivery: message,
            Recipient: playerList[counts]	//playerList.length is 10000
        });
    }
    catch{


    }
    counts++;
}

And this logic will repeat 30 times, because number of my players is about 300,000...

But there is one problem that this logic makes process heavy..(about 6gb memory...)

So, how can I send push notification to massive users in low memory?

,

First, I typed code that send push notification to players in all user segment.

const serverWorker = require('./node_modules/playfab-sdk/Scripts/PlayFab/PlayFabServer');

while (counts < 10000) {
    try {
        serverWorker.SendPushNotification({
            AdvancedPlatformDelivery: message,
            Recipient: playerList[counts]
        });
    }
    catch{
    }
    counts++;
}

And this logic will repeat 30 times, because number of my users is about 300,000.

But there is one problem that this logic makes process heavy..(about 6gb memory...)

So, how can I send push notification in low memory?

Or can I use SendPushNotification without response of http.request?

Push Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

I would suggest that you use Scheduled Tasks to perform such tasks, leaving it to PlayFab servers to do the job for you. Select “Type of task” as “Run actions on each player in a segment”, “Segment” as “All Players” and “Actions” as “Send push notification”:

Please navigate to this doc to learn more about it: Scheduled tasks


task.png (12.3 KiB)
12 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aonosomo000 avatar image aonosomo000 commented ·

Thanks to reply!

But I want to send custom push which has custom payloads or messages that changed data each times.

Can I send custom push with using Scheduled Tasks?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan aonosomo000 commented ·

Yes, of course, you can set the Action as "Execute Cloud Script", and in that function, send push notifications with custom payloads.

0 Likes 0 ·
aonosomo000 avatar image aonosomo000 Citrus Yan commented ·

Ok, I set the sheduled tasks but how write JSON on each advanced payload??

These are my sample json

but there are errors..

0 Likes 0 ·
Show more comments
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.