PWA SDK
PWA SDK Installation
Install the CloudSignal PWA SDK for push notifications and PWA features
CloudSignal PWA SDK enables push notifications, PWA installation prompts, and device tracking for web applications.
npm / yarn / pnpm
npm install @cloudsignal/pwa-sdkyarn add @cloudsignal/pwa-sdkpnpm add @cloudsignal/pwa-sdkCDN (Browser)
For browser environments without a bundler:
<!-- unpkg -->
<script src="https://unpkg.com/@cloudsignal/pwa-sdk/dist/index.global.js"></script>
<!-- jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/@cloudsignal/pwa-sdk/dist/index.global.js"></script>This exposes CloudSignalPWA as a global variable:
const pwa = new CloudSignalPWA.CloudSignalPWA({
organizationId: 'your-org-uuid',
organizationPublishableKey: 'pk_your_publishable_key',
serviceId: 'your-service-uuid'
});Service Worker
Copy the service worker to your public directory:
# From npm
cp node_modules/@cloudsignal/pwa-sdk/dist/service-worker.js public/
# Or download directly
curl -o public/service-worker.js https://unpkg.com/@cloudsignal/pwa-sdk/dist/service-worker.jsPackage Formats
The library ships with multiple formats:
- ESM (
dist/index.js) - For modern bundlers and ES modules - CJS (
dist/index.cjs) - For Node.js/SSR usage - IIFE (
dist/index.global.js) - For browser script tags - Service Worker (
dist/service-worker.js) - Standalone worker script
Requirements
- Modern browser with Service Worker support
- HTTPS (required for push notifications)
- Web App Manifest (for PWA install prompts)
TypeScript Support
Full TypeScript definitions included:
import { CloudSignalPWA, PWAConfig, DeviceInfo } from '@cloudsignal/pwa-sdk';
const config: PWAConfig = {
organizationId: 'your-org-uuid',
organizationPublishableKey: 'pk_your_publishable_key',
serviceId: 'your-service-uuid',
debug: true
};
const pwa = new CloudSignalPWA(config);