Problem with sending notifications to topic in bulk
yulianrudenko opened this issue · 7 comments
yulianrudenko commented
xtrinch commented
The docs were a bit misleading in the migration section, you should use this:
FCMDevice.objects.all().handle_topic_subscription(True, topic="TOPIC NAME"))
FCMDevice.send_topic_message(Message(data={...}), "TOPIC NAME")
As you dont send topic messages to specific devices, but rather subscribe the devices first and then send a general message to the topic
xtrinch commented
Closing issue, feel free to reopen if any more issues arise
yulianrudenko commented
*Thanks* for the explanation.
Could you please also tell me if it's possible to send
messages/notifications with *conditions* using your package? (for example
to send message only to users that are subscribed to 2 topics ath the same
time)
P.S. I know it's pretty easy to do manually but just wondering if it's
possible using your app, because didn't find anything related to this in
your repo/docs (and if not it could probably be a good *TODO* for the
future to improve your package as imho it's pretty useful functionality 🙂)
[image: image.png]
ср, 11 янв. 2023 г. в 09:46, Mojca Rojko ***@***.***>:
… The docs were a bit misleading in the migration section, you should use
this:
FCMDevice.objects.all().handle_topic_subscription(True, topic="TOPIC NAME"))
FCMDevice.send_topic_message(Message(data={...}), "TOPIC NAME")
As you dont send topic messages to specific devices, but rather subscribe
the devices first and then send a general message to the topic
—
Reply to this email directly, view it on GitHub
<#225 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVCIU4PVEA4GOEJJOZUVQH3WRZXOPANCNFSM6AAAAAATXO6HN4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
xtrinch commented
Do you have an example on how you do that manually?
yulianrudenko commented
Yes, screenshot which I've sent in previous email, from docs:
https://firebase.google.com/docs/cloud-messaging/android/topic-messaging#python_3
*I believe '||' must be replaced with '&&' in my case*
[image: image.png]
ср, 11 янв. 2023 г. в 14:34, Mojca Rojko ***@***.***>:
… Do you have an example on how you do that manually?
—
Reply to this email directly, view it on GitHub
<#225 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVCIU4PLQLAAHL6WHL7C7MDWR2ZGRANCNFSM6AAAAAATXO6HN4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
xtrinch commented
Oh yes this could be easily implemented as a copy of
fcm-django/fcm_django/models.py
Line 362 in 3da06a6
condition
instead of topic
yulianrudenko commented
Hi,
Sorry for bothering/asking You directly, but just one more question related
to Your package: if You still remember, is the package taking care of
Firebase limits?
I mean, if for example I'll try to send notifications to 2500 different
devices it will automatically split those 2500 notifications into "queues",
if i understand correctly in your code limit is set to 500 registration
tokens (I believe current limit set by Firebase is 1000), so those 2500
will ALL be sent "serially", 5 times (2500/500) not just the first 500
notifications. And so I do not have to split devices by myself before
sending, right?
Thanks in advance
ср, 11 янв. 2023 г. в 14:57, Mojca Rojko ***@***.***>:
… Oh yes this could be easily implemented as a copy of
https://github.com/xtrinch/fcm-django/blob/3da06a60970b9b61f5998128327b6fa01e628a29/fcm_django/models.py#L362,
using condition instead of topic
—
Reply to this email directly, view it on GitHub
<#225 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVCIU4IV3VZHZJIQY4JQ6JTWR236LANCNFSM6AAAAAATXO6HN4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>