An efficient Firebase Cloud Messaging Client Library for Python/asyncio
Project description
aiofcm is a library designed specifically for sending messages such as push-notifications to Android devices via Firebase Cloud Messaging platform. aiofcm provides an efficient client through asynchronous XMPP protocol for use with Python’s asyncio framework.
aiofcm requires Python 3.5 or later.
Performance
In my testing aiofcm allows you to send on average 1k messages per second on a single core.
Features
Internal connection pool which adapts to the current load
Sending notification and/or data messages
Ability to set TTL (time to live) for messages
Ability to set priority for messages
Ability to set collapse-key for messages
Installation
Use pip to install:
$ pip install aiofcm
Basic Usage
from uuid import uuid4
from aiofcm import FCM, Message, PRIORITY_HIGH
async def run():
fcm = FCM(123456789000, '<API_KEY>')
message = Message(
device_token='<DEVICE_TOKEN>',
notification={ # optional
"title": "Hello from Firebase",
"body": "This is notification",
"sound": "default"
},
data={"score": "3x1"}, # optional
message_id=str(uuid4()), # optional
time_to_live=3, # optional
priority=PRIORITY_HIGH, # optional
)
await fcm.send_message(message)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
License
aiofcm is developed and distributed under the Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aiofcm-1.4.tar.gz
.
File metadata
- Download URL: aiofcm-1.4.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff0e97c4f3d4db65a459ef44c485a80869f0567992a15b757942cb37b4b050d0 |
|
MD5 | 69c688f7769b2fea963f603af7cab136 |
|
BLAKE2b-256 | 654c515e44a26c5e9c7496ea682ad6ca5400b3db6a23c922cd682b224c33b855 |
File details
Details for the file aiofcm-1.4-py3-none-any.whl
.
File metadata
- Download URL: aiofcm-1.4-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41ed993a74f19fc9f82df16ca66a9f32d0f3a3d1d851d44d95c67b3078ab6700 |
|
MD5 | fcf399852f225548441bab26ae9b27e0 |
|
BLAKE2b-256 | 262f9bd60b441c9ec08a5e43f285089e06851bbfaf789d7dc4626b43375002d8 |