Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send data message to topic #183

Closed
LucasHild opened this issue Jan 16, 2018 · 1 comment
Closed

Send data message to topic #183

LucasHild opened this issue Jan 16, 2018 · 1 comment

Comments

@LucasHild
Copy link
Contributor

LucasHild commented Jan 16, 2018

I am trying to send a data message to the subscribers of a topic. This is my code:

result = push_service.multiple_devices_data_message(condition="'mytopic' in topics", data_message=data)

I get this error:

File "/.../venv/lib/python3.5/site-packages/pyfcm/fcm.py", line 305, in multiple_devices_data_message for registration_ids in registration_id_chunks:
File "/.../venv/lib/python3.5/site-packages/pyfcm/baseapi.py", line 65, in registration_id_chunks for i in xrange(0, len(registration_ids), self.FCM_MAX_RECIPIENTS):
TypeError: object of type 'NoneType' has no len()

How can I send a data message to a topic with this method?

@olucurious
Copy link
Owner

olucurious commented Jan 16, 2018

You should use notify_topic_subscribers

result = push_service.notify_topic_subscribers(topic_name="news", data_message = data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants