{"id":20675553,"url":"https://github.com/bitwarden/autopush-manager","last_synced_at":"2026-03-11T06:32:05.965Z","repository":{"id":252281763,"uuid":"839032719","full_name":"bitwarden/autopush-manager","owner":"bitwarden","description":"Module to subscribe to Mozilla Autopush and receive notifications.","archived":false,"fork":false,"pushed_at":"2026-02-27T15:44:00.000Z","size":590,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":13,"default_branch":"main","last_synced_at":"2026-02-27T20:43:31.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitwarden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-06T20:39:16.000Z","updated_at":"2026-02-16T09:59:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"8cd627d4-4527-4df1-9c25-a23a14b8e3d3","html_url":"https://github.com/bitwarden/autopush-manager","commit_stats":null,"previous_names":["bitwarden/autopush-manager"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bitwarden/autopush-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwarden%2Fautopush-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwarden%2Fautopush-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwarden%2Fautopush-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwarden%2Fautopush-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitwarden","download_url":"https://codeload.github.com/bitwarden/autopush-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwarden%2Fautopush-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T21:09:46.991Z","updated_at":"2026-03-11T06:32:05.930Z","avatar_url":"https://github.com/bitwarden.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Autopush-Manager\n\nA module to subscribe to Mozilla Autopush and receive notifications.\n\n## Build\n\nTo build the project, run:\n\n```bash\nnpm ci\nnpm run build\n```\n\n## Usage\n\nAutopush-Manager will run in Node and browser contexts. The goal is to bring web-push capabilities to contexts that\ncurrently lack support, such as Electron applications and certain browser contexts\n(e.g. Firefox extension background pages)\n\n\u003e **NOTE:** Autopush-Manager works in browsers in order to bring push notifications to contexts that do not yet support\n\u003e them natively. _Always_ use the natively provided `PushManager` if it is available.\n\nExample usages are provided in the [examples](./examples) directory.\n\nAutopush-Manager provides a similar interface to the native `PushManager` API.\nHowever, you must first create a `PushManager`, since none is provided by the platform.\n\n```javascript\nconst pubhManager = await createPushManager(storage, logger);\n```\n\nThe `storage` parameter is an object that implements the `Storage` interface and is used to restore connections between\napplication restarts. The `logger` parameter is an object that implements the `Logger` interface, which is a subset of\n`console`. Autopush-Manager can be quite chatty, so you may want to filter debugging messages in your logger.\n\n`createPushManager` also accepts an optional `options` parameter, which can be used to configure the `PushManager` to\ntarget a different autopush instance, ack message interval, and delay websocket reconnect attempts:\n\n```javascript\nconst pubhManager = await createPushManager(storage, logger, {\n    autopushUrl: \"wss://my.autopush.instance/\",\n    ackIntervalMs: 10_000, // defaults to 30 seconds\n    reconnectDelay: backoffMethod, // defaults to a constant 1 second\n});\n```\n\nOnce a `PushManager` is created, you can use it to subscribe to notifications:\n\n```javascript\nconst subscription = await pushManager.subscribe({\n    userVisibleOnly: true,\n    applicationServerKey: \"base64url-encoded-VAPID-public-key\",\n});\n```\n\nA single `PushManager` can manage multiple subscriptions, but only one per `applicationServerKey`.\n\nSubscriptions have a simplified event interface compared to the native `PushSubscription` interface. It emits only two events\n\n-   notification\n-   pushsubscriptionchange\n\n```javascript\nsubscription.addEventListener(\"notification\", (message) =\u003e {\n    console.log(\"Notification received:\", message);\n});\nsubscription.addEventListener(\"pushsubscriptionchange\", (subscriptionJson) =\u003e {\n    console.log(\"Push subscription changed:\", subscriptionJson);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwarden%2Fautopush-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitwarden%2Fautopush-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwarden%2Fautopush-manager/lists"}