{"_id":"@ably-labs/graphql-ably-pubsub","_rev":"9-b386cbf1358c5bab02ca70127f637d6e","name":"@ably-labs/graphql-ably-pubsub","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@ably-labs/graphql-ably-pubsub","version":"1.0.0","keywords":["GraphQL","Apollo","Apollo Server","GraphQL Subscriptions","ably","ably-pubsub"],"author":{"name":"Ably Labs, Jo Franchetti"},"license":"MIT","_id":"@ably-labs/graphql-ably-pubsub@1.0.0","maintainers":[{"name":"ably-labs","email":"devrel@ably.com"}],"homepage":"https://github.com/ably-labs/graphql-ably-pubsub#readme","bugs":{"url":"https://github.com/ably-labs/graphql-ably-pubsub/issues"},"dist":{"shasum":"bce01cec417b48a5984f9829f2156d2cc6ccfb80","tarball":"https://registry.npmjs.org/@ably-labs/graphql-ably-pubsub/-/graphql-ably-pubsub-1.0.0.tgz","fileCount":8,"integrity":"sha512-VFpUhsmi/h37j695Yuq7ZQLX7PJRfzBZ/tmYzXdExq1NkZOIlucc8I8Q9UKjyIHzoL0vFzQu+P9gGqDqstdd/g==","signatures":[{"sig":"MEUCIBowRmlaVfDPrKXTA+ZZ9TF/0wWCBz0fsJusUgukbnQ/AiEAzfuwGdldNMv93JD0C6NrcExYPWXCuCHWUip1erpbPwE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjDkQCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpzgg/+IxjqHIK0RX7T2wYmdE4Wp7dQlXtRO4KHkhQ62Me273ThITJT\r\nWI+IKPZ7/GqLJAcJL8Y5D3ZpbWk8lPRIt3lTm3q4f+OQonp6GW7esNAxNITO\r\nX7zPCKMCk7SIKoqHOREvD0VwFDmFhbnpwM94ZCgljTTAGR+TjGrkmSg2jWgJ\r\n7uNzTfh22xusYl0mDtTAzmP7MjNkhV4AkuYPYWIXw6omBahkhfYrRAY0Sokd\r\nhvLDFRHnOwBRftJtTjP13uw/ZcIID4XJ7XcwiIHTYhpT4ocuN3C8vnrbvvFI\r\nBveopnzGFvSJYHl1ojusZNDg6MUfoIy/wopRNCbwgfjw8wlCbwOpETTxzPxG\r\nb0754yvxo/yWJZK2UhXGdftCk8klY+byml70DlTbRUBTj02xe2iMzIZ4pWdi\r\n7tUy8fi4b2t/P7ZpZwXEnCooOBJbBB7ToPqgWa8eMrLNnWMEstduRPkfd270\r\n9UvM9XZw5Dg2HWB67m1z4Dn0W33PP1OJi2Z4uqf0Hge2znfKSWVjy4f0r3OR\r\nXTtZvkap1rXqeU0E0LnQll3t+ZQTP6JtQ+Zhp0pH6ryoYz7RM65pAv97Ik4a\r\ncB3q26s9B6ELGaHlfOsFaV49utiWiySCB+jtC9zKWQLNUP7l/PpW8gRStlwG\r\nKBosQDBvG2SHq+J7iEqyGabd+nqrrOyotaw=\r\n=K7kI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"b4fd443329bc587d5e64f98d45ab3aaf8feef0b9","scripts":{"build":"tsc","start":"tsc && node dist/example.js"},"_npmUser":{"name":"ably-labs","email":"devrel@ably.com"},"repository":{"url":"git+https://github.com/ably-labs/graphql-ably-pubsub.git","type":"git"},"_npmVersion":"8.15.0","description":"GraphQL Subscriptions using Ably PubSub","directories":{},"_nodeVersion":"16.17.0","dependencies":{"ably":"^1.2.29","graphql-subscriptions":"^1.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dotenv":"^16.0.1","express":"^4.17.1","graphql":"^15.5.1","typescript":"^4.5.5","apollo-server-core":"^3.6.2","@graphql-tools/schema":"^7.1.5","apollo-server-express":"^3.6.2"},"_npmOperationalInternal":{"tmp":"tmp/graphql-ably-pubsub_1.0.0_1661879298221_0.4797704060846901","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@ably-labs/graphql-ably-pubsub","version":"1.0.1","keywords":["GraphQL","Apollo","Apollo Server","GraphQL Subscriptions","ably","ably-pubsub"],"author":{"name":"Ably Labs, Jo Franchetti"},"license":"MIT","_id":"@ably-labs/graphql-ably-pubsub@1.0.1","maintainers":[{"name":"ably-labs","email":"devrel@ably.com"}],"homepage":"https://github.com/ably-labs/graphql-ably-pubsub#readme","bugs":{"url":"https://github.com/ably-labs/graphql-ably-pubsub/issues"},"dist":{"shasum":"d3a3c8904d61e008884c4eb575759c2903ae7265","tarball":"https://registry.npmjs.org/@ably-labs/graphql-ably-pubsub/-/graphql-ably-pubsub-1.0.1.tgz","fileCount":8,"integrity":"sha512-WeSQ7XnyuExdYiNd7Bo5IodzNM5UlMuaLKLVI06rduY2c2zCEIhy2S5nl1sC2YVBNLDE+iCD8CzyxN2XKfgrpQ==","signatures":[{"sig":"MEYCIQD74RigLraDbAhzFBUiRad+XIdV9Fr6VKO0dOWr4/lfrwIhALlSi/kK2XPV21Ptw/Xob5oCdovRlx0a7CsM94LCkxjq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14212,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjDks7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp95xAAjNfJNa+r2rSNYUW6Ewnpd+sW5DfRDjJmud2pxjD4OV6NDKkS\r\nQqpRuDIJ500hBBeNR4qLYXGfEHbcNvl1ViklteNcil69NHqImwqgeQNEzRJU\r\nbhiZe8eu9fyEus1O/KCyY/9IY3ZYqVumWqzwh6KtB07J6kRXboN8bDPaSePl\r\nFCWHxnBFGuhYMwEQ4/W6LGztJCNozN6havisKZ+zHvUh6EXOs5ADnUtb803W\r\n1Gm3QdP4MzNy2/vG/ZILYWOXKAVWLUvFgYihmGppjX+VHDyaC/wc7Pt4ZqF6\r\nZsPbF9vBXLkpvuvWKEjCsEewLKT+coFYWvHTWMz2xiFWDYw6xr79dPAnuc38\r\nU2QnUEfpB78OLexlhSXjyUyRd3KUKPUStSYDbErUyVw8DFQ3mk/oOHBlbaAU\r\nmsx9oDUAD4GOJraT9x1GeZt17LWPhMm0ZQqUwqsavJsEVboyn40VUyxaT7g2\r\nMz7zMOH6Glj22f7C7tIlPY+EQsbnfN0gdpI9h4wGnR4BOwlVAmQhqf//y4A6\r\nYrp2DVa79gc25WKL0XFJV0iTzyhDFZjGQFnPg8tJBGa1s9nL0eyhpPHwO3TQ\r\nW4KuGOUQssCAZvKsEeJBxWIiMiKZ/a9L5+uvD8KmmI2mmEMZ0bhth8WNMz6M\r\n/ig8gKWByh8YGCf+b0yXJlvkCLVia4Veux4=\r\n=qjj3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"8945cf308dc0365077aef54a942678149e74005b","scripts":{"build":"tsc","start":"tsc && node dist/example.js"},"_npmUser":{"name":"ably-labs","email":"devrel@ably.com"},"repository":{"url":"git+https://github.com/ably-labs/graphql-ably-pubsub.git","type":"git"},"_npmVersion":"8.15.0","description":"GraphQL Subscriptions using Ably PubSub","directories":{},"_nodeVersion":"16.17.0","dependencies":{"ably":"^1.2.29","graphql-subscriptions":"^1.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.8.1","dotenv":"^16.0.1","express":"^4.17.1","graphql":"^15.5.1","graphql-ws":"^5.10.1","typescript":"^4.5.5","apollo-server-core":"^3.6.2","@graphql-tools/schema":"^7.1.5","apollo-server-express":"^3.6.2"},"_npmOperationalInternal":{"tmp":"tmp/graphql-ably-pubsub_1.0.1_1661881146911_0.8273137127918437","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@ably-labs/graphql-ably-pubsub","version":"1.0.2","keywords":["GraphQL","Apollo","Apollo Server","GraphQL Subscriptions","ably","ably-pubsub"],"author":{"name":"Ably Labs, Jo Franchetti"},"license":"MIT","_id":"@ably-labs/graphql-ably-pubsub@1.0.2","maintainers":[{"name":"ably-labs","email":"devrel@ably.com"}],"homepage":"https://github.com/ably-labs/graphql-ably-pubsub#readme","bugs":{"url":"https://github.com/ably-labs/graphql-ably-pubsub/issues"},"dist":{"shasum":"5d3934287d1737e705d5195ad41e1ecee47d3406","tarball":"https://registry.npmjs.org/@ably-labs/graphql-ably-pubsub/-/graphql-ably-pubsub-1.0.2.tgz","fileCount":8,"integrity":"sha512-HfTvlCMeHs1N2craFmWhzQAXKOQF12tAgQs4WVsB3t+ejrUjWbGhVKxCEJyKGKuAdTE2j4dBNXN8Qju/f6GwdQ==","signatures":[{"sig":"MEUCIQCVXZ5FmcoYpwmEFcRDIQuGsZeBVE9OirTGnphCpHcnJwIgHGrvYlpzQ+IUEqu7LcF3ge/oz0dzyMVaJ+ef0cv2M5s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14212,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjDkt4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxlA//W54/gTVH7tIX5CNDQ9xHlLJOMvlY5AltAO61dMjf6pUSO1zO\r\nzJGmR0pbjYoRGnYmmH1Psyj2i3rpsG/EMZm8ROvqcNBrAhe2fgIrJwWi8NzN\r\nSlN1M+CNxcqq0+8lBWkw+Z2oPF51yuWJIK6I+GvXfAXVaicSpJ3fJj/WY2WT\r\nHIRZfG6dJvJKOm1o0WRlsm8jxBN/rf6166YtigDWeh17up1jqJ/w4UohmGIC\r\nSdr4e0CE9ZbTJ+NC4Mj/Zy16bE0PUvIo3k8oCbFShBA5sccZ+lcdcXEzVhAe\r\nZgvrMAZzDECyBC+VDSM365W9s9dXYtBkXYO61Ps9t11jXi688p/gODd2WF0z\r\nmPdnHWJ2XzC4YnKOXDq8XUlQPw+lXKkrpzAfGhSJEYd1is3hSIucp/6BBcQ7\r\n0MaFVorunOFFjuS/OlzsgkSIqqb2SDa0PhxPMoKFQ3jh3wpmRhhJgdHvrl7c\r\nk9R0mAsVFuhfJf0p++JTUftfATe81Vx/lX2cezHNxkFZGVwG6xgBK3j6f0CA\r\nsTKraNU3JGGyarj6geKX97Pp5JMImCjDEzuzIyocRkxOT2j3LtaL/vtlwvwx\r\nJcq5NA2Y2QHke9V1g+FJ6qcYF2CMe6fcSbYsnT7byFWqqvXIQIJtM2ChP3Pk\r\n3Wg3z5SkR0eRROM68fmgeSfIJLdts3WKpZs=\r\n=XGdj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"25379e33e3b12ec2840c6475c2758bb14a967a8e","scripts":{"build":"tsc","start":"tsc && node dist/example.js"},"_npmUser":{"name":"ably-labs","email":"devrel@ably.com"},"repository":{"url":"git+https://github.com/ably-labs/graphql-ably-pubsub.git","type":"git"},"_npmVersion":"8.15.0","description":"GraphQL Subscriptions using Ably PubSub","directories":{},"_nodeVersion":"16.17.0","dependencies":{"ably":"^1.2.29","graphql-subscriptions":"^1.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.8.1","dotenv":"^16.0.1","express":"^4.17.1","graphql":"^15.5.1","graphql-ws":"^5.10.1","typescript":"^4.5.5","apollo-server-core":"^3.6.2","@graphql-tools/schema":"^7.1.5","apollo-server-express":"^3.6.2"},"_npmOperationalInternal":{"tmp":"tmp/graphql-ably-pubsub_1.0.2_1661881208392_0.4778526701272938","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-08-30T17:08:18.155Z","modified":"2024-10-09T11:06:58.333Z","1.0.0":"2022-08-30T17:08:18.344Z","1.0.1":"2022-08-30T17:39:07.081Z","1.0.2":"2022-08-30T17:40:08.556Z"},"bugs":{"url":"https://github.com/ably-labs/graphql-ably-pubsub/issues"},"author":{"name":"Ably Labs, Jo Franchetti"},"license":"MIT","homepage":"https://github.com/ably-labs/graphql-ably-pubsub#readme","keywords":["GraphQL","Apollo","Apollo Server","GraphQL Subscriptions","ably","ably-pubsub"],"repository":{"url":"git+https://github.com/ably-labs/graphql-ably-pubsub.git","type":"git"},"description":"GraphQL Subscriptions using Ably PubSub","maintainers":[{"email":"andrii.bulat@ably.com","name":"andrii.bulat.ably"},{"email":"khokhlov.e.n@gmail.com","name":"ttypic"},{"email":"mike@christensen.codes","name":"mschristensen"},{"email":"account.owners@ably.com","name":"ably-realtime"},{"email":"owen.pearson@ably.com","name":"owenpearson"},{"email":"lewis@lmars.net","name":"lmars"},{"email":"devrel@ably.com","name":"ably-labs-user"}],"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\ncd api\necho ABLY_API_KEY=YOUR-API-KEY-HERE > .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\nBut the more 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: () => 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<a href=\"https://codesandbox.io/s/github/ably-labs/graphql-ably-pubsub?fontsize=14&hidenavigation=1&initialpath=%2Fgraphql&theme=dark\">\n  <img alt=\"Edit\" src=\"https://codesandbox.io/static/img/play-codesandbox.svg\">\n</a>\n","readmeFilename":"README.md"}