Open tranvannhat opened 1 month ago
from pyfcm.async_fcm import fetch_tasks
from pyfcm.baseapi import BaseAPI
class FCMNotification(BaseAPI):
async def send_async_request(self, params_list, timeout=5):
payloads = [self.parse_payload(**params) for params in params_list]
responses = await fetch_tasks(
end_point=self.FCM_END_POINT,
headers=self.request_headers(),
payloads=payloads,
timeout=timeout,
)
return responses
Create a new FCM class inherit from the BaseAPI
and replace async_notify_multiple_devices
usages with send_async_request
will resolve your issue
fastapi = "^0.111.0" pyfcm = "^2.0.4" I using async_notify_multiple_devices and get error: Cannot run the event loop while another loop is running