Сервис по отправке push-уведомлений через Firebase Cloud Messaging
Общее описание
fcm-notifier представляет собой сервис, который отдельно запускается в окружении РИС и с заданной периодичностью забирает накопившиеся сообщения из очереди, которые пачкой (до 500 штук) отправляет на мобильные устройства через FCM backend используя Firebase Admin SDK.
Настройка сервиса
Для работы сервиса необходимо в переменных окружения задать две переменные:
Путь до JSON-файла содержащего приватный ключ для доступа к сервисам Google:
export GOOGLE_APPLICATION_CREDENTIALS=/opt/bars/fcm-notifier/mydiary.json
Путь до директории содержащей файл конфигурации сервиса:
export FCM_NOTIFIER_CONFIG_DIR=/opt/bars/fcm-notifier/
Файл конфигурации fcm_notifier.conf:
[redis]
REDIS_HOST = 127.0.0.1
REDIS_PORT = 6379
REDIS_DB = 12
REDIS_PASSWORD =
[logging]
LEVEL = INFO
Запуск сервиса
$ fcm-notifier worker
Использование очереди сообщений в РИС
Добавление сообщения в очередь:
from fcm_notifier.helpers import get_redis_connection
from fcm_notifier.notification import Notification, NotificationPayload
from fcm_notifier.queue import RedisQueue
queue = RedisQueue(connection=get_redis_connection())
notification = Notification(
payload=NotificationPayload(
title='Test message!',
body='Message body',
),
token='dsufZwUdSFaeIGFt77aMwm:APA91bHQje7R...',
)
queue.enqueue_notification(notification)
Metadata
Release files for fcm-notifier 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fcm_notifier-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for fcm_notifier-0.2.4-py3-none-any.whl |
Release files / fcm_notifier-0.2.4-py3-none-any.whl
| Download URL | fcm_notifier-0.2.4-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fec579f5324419440f68f3d4b1f6a333e4799e9a248fec3fce9eae7192b6af29
|
|
BLAKE2b-256 checksum How to use checksums |
4cc376bdf835613d911eb9f90564053ef0022150bb385a61fa2cfff33993c41a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Security for fcm-notifier 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.