{"id":36498225,"url":"https://github.com/cafjs/caf_pubsub","last_synced_at":"2026-01-15T02:57:21.043Z","repository":{"id":6357235,"uuid":"7594243","full_name":"cafjs/caf_pubsub","owner":"cafjs","description":"CAF extra lib to a publish/subscribe service","archived":false,"fork":false,"pushed_at":"2023-04-18T22:34:14.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-02T08:48:07.511Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"inquisb/icmpsh","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cafjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-13T22:03:33.000Z","updated_at":"2021-11-12T04:08:31.000Z","dependencies_parsed_at":"2023-01-13T13:58:48.157Z","dependency_job_id":null,"html_url":"https://github.com/cafjs/caf_pubsub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cafjs/caf_pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafjs%2Fcaf_pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafjs%2Fcaf_pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafjs%2Fcaf_pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafjs%2Fcaf_pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cafjs","download_url":"https://codeload.github.com/cafjs/caf_pubsub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafjs%2Fcaf_pubsub/sbom","scorecard":{"id":261774,"data":{"date":"2025-08-11","repo":{"name":"github.com/cafjs/caf_pubsub","commit":"76cff086a5e0435b68eeab7440e49e584005e4d9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/push.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/cafjs/caf_pubsub/push.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE-2.0.txt:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T10:58:40.660Z","repository_id":6357235,"created_at":"2025-08-17T10:58:40.660Z","updated_at":"2025-08-17T10:58:40.660Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2026-01-12T02:05:41.125Z","updated_at":"2026-01-15T02:57:21.038Z","avatar_url":"https://github.com/cafjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Caf.js\n\nCo-design cloud assistants with your web app and IoT devices.\n\nSee https://www.cafjs.com\n\n## Library to Access a Publish/Subscribe Bus\n\n[![Build Status](https://github.com/cafjs/caf_pubsub/actions/workflows/push.yml/badge.svg)](https://github.com/cafjs/caf_pubsub/actions/workflows/push.yml)\n\nThis repository contains a `Caf.js` library that implements a publish/subscribe bus using, for example, a `Redis` backend.\n\nThere are two types of channels:\n\n * A *private channel* name is prefixed by the CA name, i.e., `\u003cca_name\u003e-\u003cwhatever\u003e`, and only that CA can publish messages.\n\n * A *forum channel* has a name of the form `forum-\u003cwhatever\u003e`, and anybody can publish to it. However, subscribers can filter publishers using method ACLs, since pubsub messages are always processed by invoking a CA method. This method is chosen by the subscriber.\n\nAnybody can subscribe to a channel if they know its name, and we recommend to use hard to guess channel names to limit visibility.\n\nThe delivery guarantees depend on the pubsub backend service. `Redis`, for example, is best effort. However, when the plugin has committed to publish a message, it will retry after a CA or node.js process crash.\n\nA pubsub service complements well a `SharedMap` (see {@link external:caf_sharing}). `SharedMaps` are silently updated, and this makes them very efficient when shared by many CAs. Messages generated by a pubsub service are processed by subscribed CAs and, for example, can trigger external actions. By combining them, we can get the right mix of silent updates vs external actions.\n\n`Caf.js` discourages `point-to-point` communication between CAs. At the network infrastructure level, `point-to-point` becomes `all-to-all` very quickly, limiting the scalability of the system.\n\nHowever, if you really need `point-to-point`, you can always use a *private pubsub channel*, or write a new plugin...\n\nInstead, applications should expose higher-level communication patterns to improve scalability. These patterns can then be implemented efficiently with specialized services, such as `SharedMap` or `pubsub`. This approach is common for HPC applications that, for example, use MPI collective communication calls.\n\n### Hello World (see `examples/helloworld`)\n\nThe following example has a privileged CA, i.e., `admin`, that regularly publishes messages in a private channel. CAs with the same owner subscribe to this channel, and the handler function notifies clients using sessions (see {@link external:caf_session}).\n\n```\nexports.methods = {\n    async __ca_init__() {\n        this.state.counter = 0;\n        this.$.pubsub.subscribe(mainChannel(this), '__ca_handle__');\n        this.$.security.addRule(this.$.security.newSimpleRule(\n            '__ca_handle__', this.$.security.SELF, ADMIN_CA\n        ));\n        return [];\n    },\n    async __ca_pulse__() {\n        if (isAdmin(this)) {\n            this.state.counter = this.state.counter + 1;\n            this.$.pubsub.publish(mainChannel(this),\n                                  'Counter: ' + this.state.counter);\n        }\n        return [];\n    },\n    async __ca_handle__(topic, msg, from) {\n        this.$.log \u0026\u0026 this.$.log.debug('Got ' + msg);\n        this.$.session.notify([msg]);\n        return [];\n    }\n}\n```\n\nA couple of helper functions for naming:\n\n```\nconst ADMIN_CA = 'admin';\nconst ADMIN_CHANNEL = 'myNews';\nconst isAdmin = function(self) {\n    const name = self.__ca_getName__();\n    return (caf.splitName(name)[1] === ADMIN_CA);\n};\nconst mainChannel = function(self) {\n    const name = self.__ca_getName__();\n    return caf.joinName(caf.splitName(name)[0], ADMIN_CA, ADMIN_CHANNEL);\n};\n```\n\nSee the client code in `examples/helloworld/client1.js`\n\n## API\n\nSee {@link module:caf_pubsub/proxy_pubsub}\n\n## Configuration\n\n### framework.json\n\nSee {@link module:caf_pubsub/plug_pubsub}\n\n### ca.json\n\nSee {@link module:caf_pubsub/plug_ca_pubsub}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafjs%2Fcaf_pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcafjs%2Fcaf_pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafjs%2Fcaf_pubsub/lists"}