Firebase

Firebase is a platform developed by Google for creating mobile and web applications.

Cloud messaging

pyfcm

   1 # the fcm client must subscribe a topic that matches the device uuid
   2 from pyfcm import FCMNotification
   3 
   4 cloud_messaging_server_key ="AAAA(...)" # missing data foe the key
   5 push_service = FCMNotification(api_key=cloud_messaging_server_key, proxy_dict=None)
   6 
   7 message_body = "Hello"
   8 data_message = {
   9     "user" : "Mario",
  10     "body" : message_body,
  11     "chatRoom" : "PortugalVSDenmark"
  12 }
  13 
  14 device_uuid="8ab6abc19dc54262"
  15 
  16 result = push_service.notify_topic_subscribers(topic_name=device_uuid, 
  17     message_body=message_body, data_message=data_message)
  18 print(result)

Firebase (last edited 2020-10-28 15:16:14 by localhost)