webapp-astro-pwa
Version:
A ready-to-use Astro component library for adding Progressive Web App (PWA) support to your Astro projects. This package provides drop-in components and utilities for manifest injection, service worker registration, install prompts, and more. Includes a w
15 lines (13 loc) • 523 B
text/typescript
import { messaging } from "./firebaseConfig";
async function sendMessageToDevice(message: any) {
try {
const response = await messaging.sendEachForMulticast(message);
const responseMessage = `Successfully sent message: ${response.successCount} successful, ${response.failureCount} failed.`;
console.log(responseMessage);
return { message: responseMessage, ok: true, response };
} catch (error) {
console.log("Error sending message:", error);
return error;
}
}
export { sendMessageToDevice };