olucurious / PyFCM

Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
http://olucurious.github.io/PyFCM/
MIT License
805 stars 205 forks source link

Add posibility to subscribe just a one token to just a one topic? #232

Closed ghost closed 5 years ago

ghost commented 5 years ago

As I can see here, we can subscribe a list of tokens to a topic! https://github.com/olucurious/PyFCM/blob/master/pyfcm/baseapi.py#L269 But how to subscribe only one token to one topic?

LucasHild commented 5 years ago

What about just putting one registration id in the list?

subscribe_registration_ids_to_topic(self, [registration_id], topic_name)
ghost commented 5 years ago

like this?:

mylist = []
mylist.append('some token')
subscribe_registration_ids_to_topic(mylist, 'topic')

I think we should add subscribe_registration_id_to_topic('my key', 'mytopic')

LucasHild commented 5 years ago

You don't have to create a new list and append items to it. You can do it easily in one line:

subscribe_registration_ids_to_topic(self, ["some token"], "mytopic")

Thanks for the proposal. I don't think that a method subscribe_registration_id_to_topic is really required, because it just makes the library harder to maintain and adding the brackets around the token is not that much work.