{"id":14976217,"url":"https://github.com/ably-labs/graphql-ably-pubsub","last_synced_at":"2025-10-27T18:30:49.263Z","repository":{"id":65369896,"uuid":"530744777","full_name":"ably-labs/graphql-ably-pubsub","owner":"ably-labs","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-13T06:42:29.000Z","size":2915,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T04:29:45.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ably-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-30T16:43:05.000Z","updated_at":"2024-06-09T13:14:42.000Z","dependencies_parsed_at":"2023-03-10T18:44:49.908Z","dependency_job_id":null,"html_url":"https://github.com/ably-labs/graphql-ably-pubsub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ably-labs/graphql-ably-pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fgraphql-ably-pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fgraphql-ably-pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fgraphql-ably-pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fgraphql-ably-pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ably-labs","download_url":"https://codeload.github.com/ably-labs/graphql-ably-pubsub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fgraphql-ably-pubsub/sbom","scorecard":{"id":161259,"data":{"date":"2025-08-11","repo":{"name":"github.com/ably-labs/graphql-ably-pubsub","commit":"bdd24bc93a0d43d809b88e8da0f3bc72310a91a1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/10 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":"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":"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":"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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/npm-publish.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":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/ably-labs/graphql-ably-pubsub/npm-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/ably-labs/graphql-ably-pubsub/npm-publish.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/npm-publish.yml:20","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   2 npmCommand 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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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 'main'"],"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-8r69-3cvp-wxc3","Warn: Project is vulnerable to: GHSA-j5g3-5c8r-7qfx","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T13:30:30.456Z","repository_id":65369896,"created_at":"2025-08-16T13:30:30.456Z","updated_at":"2025-08-16T13:30:30.456Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281319821,"owners_count":26481068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"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":"2024-09-24T13:53:31.489Z","updated_at":"2025-10-27T18:30:48.936Z","avatar_url":"https://github.com/ably-labs.png","language":"TypeScript","readme":"# GraphQL Ably PubSub\n\nThis is an [Ably](https://ably.com) implementation of the `PubSubEngine` base-class to enable [Subscriptions](https://www.apollographql.com/docs/apollo-server/data/subscriptions) in Apollo Server. This implementation uses Ably as the message transport for the WebSocket portion of Apollo Subscriptions, allowing you to use the feature without managing and maintaining your own WebSocket Server.\n\nPlease consult the [Apollo Server documentation](https://www.apollographql.com/docs/apollo-server/data/subscriptions) for more information on how to use this feature.\n\n## Pre-Requirements\nIn order to run use the AblyPubSub class, you will need an Ably API key. If you are not already signed up, you can [sign up now for a free Ably account](https://www.ably.com/signup). Once you have an Ably account:\n\n1. Log into your app dashboard.\n2. Under **“Your apps”**, click on **“Manage app”** for any app you wish to use for this tutorial, or create a new one with the “Create New App” button.\n3. Click on the **“API Keys”** tab.\n4. Copy the secret **“API Key”** value from your Root key, we will use this to configure our app.\n\n### Configuring your Ably API keys\n\n#### For local development\n\nYou need to create a `.env` file in the root with a variable defined called `ABLY_API_KEY` to store your secret.\nYou can do this from the command line if you like:\n\n```bash\necho ABLY_API_KEY=YOUR-API-KEY-HERE \u003e .env\n```\n\n## Installation\n\n```bash\nnpm install --save @ably-labs/graphql-ably-pubsub\n```\n\n## Usage\n\nYou can run a full example by running\n\n```bash\nnpm run start\n```\n\nOpen up the Apollo GraphQL studio in your web browser (http://localhost:4000/graphql) and click the \"Query your server\" button. Then, update the ExampleQuery to be the following:\n\n```\nquery ExampleQuery {\n  currentNumber\n}\n```\n\nAnd run the query. Re-run the query and you'll see the `currentNumber` value changing.\n\n![Apollo GraphQL studio showing example query](docs/apollographql-query.png)\n\nTo see the updates in realtime, go to the Ably dashboard and select the Ably application you've used for the GraphQL example and select the \"Dev console\" tab. Attach to the channel `NUMBER_INCREMENTED` and you'll see the updates coming in as new events are triggered on that channel via the GraphQL subscription.\n\n![Ably Dev console showing realtime channel updates](docs/ably-dev-console.png)\n\nThe important parts of the example are shown here:\n\n```js\nimport AblyPubSub from \"./index.js\"; \n\n// The AblyPubSub constructor accepts all the same configuration options as the Ably JS SDK.\n// Make sure to keep your API key safe! Here, we're loading it from the environment.\nconst pubsub = new AblyPubSub({ key: process.env.ABLY_API_KEY });\n\n// ...\n\n// Resolver map\nconst resolvers = {\n  Query: {\n    currentNumber() {\n      return currentNumber;\n    },\n  },\n  Subscription: {\n    numberIncremented: {\n      subscribe: () =\u003e pubsub.asyncIterator([\"NUMBER_INCREMENTED\"]),\n    },\n  },\n};\n\n// ...\n\n// In the background, increment a number every second and notify subscribers when\n// it changes.\nlet currentNumber = 0;\nfunction incrementNumber() {\n  currentNumber++;\n  pubsub.publish(\"NUMBER_INCREMENTED\", { numberIncremented: currentNumber });\n  setTimeout(incrementNumber, 1000);\n}\n// Start incrementing\nincrementNumber();\n```\n\n## About Ably\n\nAbly makes it simple for developers to build live experiences for millions of people. Our platform provides a highly available, massively scalable, low latency, globally distributed WebSockets infrastructure - at the call of an API. \n\nWe provide serverless pub/sub messaging with unique data integrity guarantees, delivered at the edge over WebSockets. Our highly reliable, elastic infrastructure was specifically designed for building high-scale realtime web and mobile applications. We free engineers to focus on building core functionality, rather than having to provision and maintain WebSocket servers and cloud infrastructure. \n\n## Example\n\nThis example is based on the [\"Subscriptions in Apollo Server v3\" sample](https://www.apollographql.com/docs/apollo-server/data/subscriptions/).\n\nThe text below is lifted directly from the sample, with the `AblyPubSub` implementation of the `PubSubEngine` replacing the original `PubSub` implementation referenced in the official documentation as \"not fit for production use\".\n\nThis example demonstrates a basic subscription operation in Apollo Server.\n[See the docs on subscriptions](https://www.apollographql.com/docs/apollo-server/data/subscriptions/)\n\nThe example server exposes one subscription (`numberIncremented`) that returns\nan integer that's incremented on the server every second.\n\nAfter you start up this server, you can test out running a subscription with the\nApollo Studio Explorer by following the link from http://localhost:4000/graphql\nto the Apollo Sandbox. You may need to edit the Apollo Sandbox connection\nsettings to select the\n[`graphql-ws` subscriptions implementation](https://www.apollographql.com/docs/studio/explorer/additional-features/#subscription-support).\nYou'll see the subscription's value update every second.\n\n```graphql\nsubscription IncrementingNumber {\n  numberIncremented\n}\n```\n\n## Run locally\n\n```shell\nnpm install\nnpm run start\n```\n\n## Run in CodeSandbox\n\n\u003ca href=\"https://codesandbox.io/s/github/ably-labs/graphql-ably-pubsub?fontsize=14\u0026hidenavigation=1\u0026initialpath=%2Fgraphql\u0026theme=dark\"\u003e\n  \u003cimg alt=\"Edit\" src=\"https://codesandbox.io/static/img/play-codesandbox.svg\"\u003e\n\u003c/a\u003e\n","funding_links":[],"categories":["Implementations"],"sub_categories":["JavaScript/TypeScript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably-labs%2Fgraphql-ably-pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fably-labs%2Fgraphql-ably-pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably-labs%2Fgraphql-ably-pubsub/lists"}