Closed rollue closed 3 years ago
I tried sending messages in bulk as described in the doc
devices.send_message( "Happy name day!", badge=lambda token: APNSDevice.objects.get(registration_id=token).user.get_badge() )
But I get TypeError: Object of type function is not JSON serializable error on line 152 in gcm.py where it says
TypeError: Object of type function is not JSON serializable
... json_payload = json.dumps(payload, separators=(",", ":"), sort_keys=True).encode("utf-8") ...
the payload that is used as a parameter to the json.dumps is as follows:
{ 'registration_ids': ['some value.....'], 'notification': {'body': {'title': 'title..........', 'body': '.......'}, 'badge': <function ParticipationRequestWriteSerializer._record_notifications.<locals>.<lambda> at 0x10c2d00d0>} }
It seems the lambda function that is passed as a keyword param(=badge) is not returning the value, but stays as a raw method. Any ideas?
GCMDevice does not support bulk send_message. I think this ought to be in the doc.
See my comment in https://github.com/jazzband/django-push-notifications/issues/477
Closing the issue as it's a duplicate.
I tried sending messages in bulk as described in the doc
But I get
TypeError: Object of type function is not JSON serializable
error on line 152 in gcm.py where it saysthe payload that is used as a parameter to the json.dumps is as follows:
It seems the lambda function that is passed as a keyword param(=badge) is not returning the value, but stays as a raw method. Any ideas?