{"_id":"@baransu/subscriptions-transport-sse","_rev":"2-134e53f290cfa6eef20d2cab6c912fd4","name":"@baransu/subscriptions-transport-sse","dist-tags":{"latest":"0.10.1"},"versions":{"0.10.0":{"name":"@baransu/subscriptions-transport-sse","private":false,"version":"0.10.0","author":{"name":"Mike Bild","email":"mike.bild@googlemail.com"},"license":"MIT","homepage":"https://github.com/mikebild/subscriptions-transport-sse#readme","repository":{"type":"git","url":"git+https://github.com/mikebild/subscriptions-transport-sse.git"},"bugs":{"url":"https://github.com/mikebild/subscriptions-transport-sse/issues"},"keywords":["graphql","subscriptions","sse","expressjs","transport","connection"],"main":"dist/express.js","browser":"dist/client.js","scripts":{"build":"babel src -d dist --source-maps --presets=env --plugins=transform-runtime","browser-compile":"webpack --config webpack.config.js","dev":"nodemon --watch src --exec \"npm run build\"","prepublish":"npm run build && npm run browser-compile"},"dependencies":{"apollo-link":"^1.2.1","babel-runtime":"^6.23.0","graphql":"^0.11.6","graphql-subscriptions":"^0.5.4","lodash.isobject":"^3.0.2","lodash.isstring":"^4.0.1","react-native-event-source":"^1.0.1"},"devDependencies":{"babel-cli":"^6.24.1","babel-plugin-transform-runtime":"^6.23.0","babel-preset-env":"^1.6.0","mocha":"^4.0.1","nodemon":"^1.11.0","webpack":"^3.6.0"},"gitHead":"d1b05ac6066d0afd317383aae5891b78172fb527","description":"A GraphQL Server-Side-Events (SSE) server and client to facilitate GraphQL subscriptions.","_id":"@baransu/subscriptions-transport-sse@0.10.0","_npmVersion":"6.5.0","_nodeVersion":"8.11.4","_npmUser":{"name":"baransu","email":"tomaszcichocinski@gmail.com"},"dist":{"integrity":"sha512-sGyW5PKzuaAvwKWp3bzU+z7Wk8AkaEvRNs0gejmhcNcBMuc/yU3GHZ85irnRoDxdkm6BF2u2xIHpQD3HLYt77Q==","shasum":"babf712d58961a8b2902e648def7dde7f81b3681","tarball":"https://registry.npmjs.org/@baransu/subscriptions-transport-sse/-/subscriptions-transport-sse-0.10.0.tgz","fileCount":8,"unpackedSize":189646,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVLvbCRA9TVsSAnZWagAAw0sP/R3CQcJl4W7vRcnMaBca\n2hjW7jEblU0gbZ+l7aKyE95IJulnOT0ocdspU231Agaohw/63bkAuXm3Pv2M\n3Z59QUZbkJ42xLGami02f0JJbV3It798otJhiuTSGjjFDE/O81ioWeYyUmjB\nGu70Tb490RA7H9b7wZvXNgvNIBDaxYSqFBElA8jOLFMUqKq+RZsa4GwV+oBR\nbj67J8HfWsqZf6bGBix6Y5nuZAm9Pp/F8OA7vnj5uZ8vYcjZ+GtDIRiR+deF\nB2sasvOUtOBX4oJl1MycVQ1Wd4BeWokjDDff3sxwBVS7mfiO4BktzraMB2qV\nex3P7+LJGgie31hxqw6roN2kAQ8Gt5P55aWTIJD5CUA/vyYb1XTvAiRboII/\n0qLrQoHAGDb1jtePqmpDq03NwNMtVuHM05m5F8pjLT0xqWDZ09ggNlPvPDrL\nNZ4TBLM2YoHHrPTtxYTZyHLbpn7hEAMHCWe+EmUxgXZ4/xMs/UmqLzk2K18Z\njnCOnPyTHwXZDgBZjILIw4AvLQ3MoVpW3jtWciwXL5/GGzA/GCFeZPGZ4g2D\n+ox/Mh42jnu0yocWfHBysmMd8jKhGm9/DzGZg/nFOhPecf+4hF0+F6IogM2d\nv7/NWxj+gqhHbf4xH1bgiFqyi1NLBgf7t9E01sYvHkIWDdGMQtNx96NHalD7\nmFN1\r\n=uX4Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDf/kQTxe8bguqqmkizU2btNAW2I714FxrSlr1GLvfPwIgFyFDQ7/R08OFm/SV0USKM/U0YzKiCt5HR5DCPUqk67I="}]},"maintainers":[{"name":"baransu","email":"tomaszcichocinski@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/subscriptions-transport-sse_0.10.0_1549056984767_0.8479566313350471"},"_hasShrinkwrap":false},"0.10.1":{"name":"@baransu/subscriptions-transport-sse","private":false,"version":"0.10.1","author":{"name":"Mike Bild","email":"mike.bild@googlemail.com"},"license":"MIT","homepage":"https://github.com/mikebild/subscriptions-transport-sse#readme","repository":{"type":"git","url":"git+https://github.com/mikebild/subscriptions-transport-sse.git"},"bugs":{"url":"https://github.com/mikebild/subscriptions-transport-sse/issues"},"keywords":["graphql","subscriptions","sse","expressjs","transport","connection"],"main":"dist/express.js","browser":"dist/client.js","scripts":{"build":"babel src -d dist --source-maps --presets=env --plugins=transform-runtime","browser-compile":"webpack --config webpack.config.js","dev":"nodemon --watch src --exec \"npm run build\"","prepublish":"npm run build && npm run browser-compile"},"dependencies":{"apollo-link":"^1.2.1","babel-runtime":"^6.23.0","graphql":"^0.11.6","graphql-subscriptions":"^0.5.4","lodash.isobject":"^3.0.2","lodash.isstring":"^4.0.1"},"devDependencies":{"babel-cli":"^6.24.1","babel-plugin-transform-runtime":"^6.23.0","babel-preset-env":"^1.6.0","mocha":"^4.0.1","nodemon":"^1.11.0","webpack":"^3.6.0"},"description":"A GraphQL Server-Side-Events (SSE) server and client to facilitate GraphQL subscriptions.","licenseText":"Copyright (c) 2017 Mike Bild\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@baransu/subscriptions-transport-sse@0.10.1","dist":{"shasum":"d666b8b986c7f9a18af6461151c675272a555298","integrity":"sha512-A9yHUh3ELm6OjWH84/SqgqE3VlwNsBV38KIOGnW/OI85rYA7cOPMXXGIZnk9zrQT6WZPSOjfbEmpRZoqFHga8Q==","tarball":"https://registry.npmjs.org/@baransu/subscriptions-transport-sse/-/subscriptions-transport-sse-0.10.1.tgz","fileCount":13,"unpackedSize":207405,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVYNUCRA9TVsSAnZWagAAn/YQAKKh9qKwbYrqeL+J17zC\niD6klxidTUlQkCn2sjElrzWT+4bioK+oOVbz8DGXo6NLVj2FhZLYq6d3tgWd\nNPO88lkjTgw2mcYzuKrCkLfcK8hHMq3UGH1Z9mngTaO9dV8ZsNDJs3dLlaX9\n7qGdSpxxEAOJCt+YIJH8mUppSsKWCr3jmwXxaARJMmvMcizjXDyFKGmvA4E6\nAqcZB83T2e3T0oFmbpM/v24pVL1cpbuPS6FXEHZSr1eLfyDjv7CVph9Z0ybk\nBeGJKr0oq6JaCaywFDEayM/6OeKrpaHzBlusPm35QaAVtv7xJawzTGGfxkOA\ncxfU6xgSw7c6shCUID1+yy9ko+9gyzbMLHf/F9hRCyweGZtEEoDeNe/+GSqs\nFo1aq7V0aZrF5RedMVB3elMzWyOfq5EWfE4lLQiFTo0Y1yMoGksdouTxscmB\nap4b3y2aGxiFL3fL4uS4I3rJv3SSslE/fY2S9L0+QZtbP731IHrPP9WFtOs/\nYyxv+bEuZvzN5f5Wl6hF91WL7bLL4BK78qMFHC2nlgd87eKMGHwCw4Og1NOs\nWubQI/MWLKUmcyA7HhujUrAz9W1CV4aNDcqniDqYN7jV5KWoeTorw/Ni8dDX\noEsPST0gr3b7u8HA46ci/8QGbGr+tcQpYjADj2vDPQRjhGrVB3joCxDcq+L9\nnqzp\r\n=aQOZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRpVOi9jFmOqgEd0CncGXGt2BLMbTXvYaxS6JZuqSNwQIgV+sFuDzkaD169AqpNwqGzEbijblPEd4NNisDsboYwx0="}]},"maintainers":[{"name":"baransu","email":"tomaszcichocinski@gmail.com"}],"_npmUser":{"name":"baransu","email":"tomaszcichocinski@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/subscriptions-transport-sse_0.10.1_1549108052086_0.5516936596282849"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-01T21:36:24.587Z","0.10.0":"2019-02-01T21:36:24.889Z","modified":"2022-04-04T17:43:03.940Z","0.10.1":"2019-02-02T11:47:32.240Z"},"maintainers":[{"name":"baransu","email":"tomaszcichocinski@gmail.com"}],"description":"A GraphQL Server-Side-Events (SSE) server and client to facilitate GraphQL subscriptions.","homepage":"https://github.com/mikebild/subscriptions-transport-sse#readme","keywords":["graphql","subscriptions","sse","expressjs","transport","connection"],"repository":{"type":"git","url":"git+https://github.com/mikebild/subscriptions-transport-sse.git"},"author":{"name":"Mike Bild","email":"mike.bild@googlemail.com"},"bugs":{"url":"https://github.com/mikebild/subscriptions-transport-sse/issues"},"license":"MIT","readme":"# subscriptions-transport-sse\n\nA GraphQL Server-Side-Events (SSE) server and client to facilitate GraphQL subscriptions.\n\n> That's an API compatible SSE transport implementation of [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws).\n\n## Example\n\n* [GraphQL subscriptions over Server-Side-Events](https://github.com/MikeBild/graphql-subscriptions-sse-presence-list)\n\n## Getting Started\n\n```bash\nUsing Yarn:\n$ yarn add subscriptions-transport-sse\n\nOr, using NPM:\n$ npm install --save subscriptions-transport-sse\n```\n\n### ExpressJS Server\n\nStarting with the server, create a new simple SubscriptionsManager, with a PubSub implementation:\n\n```javascript\nimport { SubscriptionManager, PubSub } from 'graphql-subscriptions'\n\nconst schema = {} // Replace with your GraphQL schema object\nconst pubsub = new PubSub()\n\nconst subscriptionManager = new SubscriptionManager({\n  schema,\n  pubsub\n})\n```\n\nNow, use your subscriptionManager, and create your SubscriptionServer:\n\n```javascript\nconst express = require('express')\nconst app = express()\nconst expressGraphQLSubscriptionsSSETransport = require('subscriptions-transport-sse')\n\nexpressGraphQLSubscriptionsSSETransport.SubscriptionServer({\n  onSubscribe: (msg, params) => Object.assign({}, params, { context: { loaders: loaders(), } }),\n  subscriptionManager: graphqlSubscriptions.subscriptionManager,\n}, {\n  express: app,\n  path: '/subscriptions',\n})\n\napp.listen(SERVICE_PORT, () => console.log(`Listen on ${SERVICE_PORT}`))\n```\n\n### Apollo Client (Browser)\n\nFor client side, we will use SubscriptionClient, and we also need to extend our network interface to use this transport for GraphQL subscriptions:\n\n```javascript\nimport { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-sse'\nconst httpClient = createNetworkInterface({uri: `https://my-graphql.example.com/graphql`})\nconst sseClient = new SubscriptionClient(`https://my-graphql.example.com/subscriptions`)\nconst apolloClient = new ApolloClient({networkInterface: addGraphQLSubscriptions(httpClient, sseClient)})\n```\n\nNow, when you want to use subscriptions in client side, use your ApolloClient instance, with subscribe or subscribeToMore (according to your apollo-client usage):\n\n```javascript\napolloClient.subscribeToMore({\n    document: gql`\n        subscription onNewItem {\n            newItemCreated {\n                id\n            }\n        }`,\n    variables: {},\n    updateQuery: (prev, {subscriptionData}) => {\n        return; // Modify your store and return new state with the new arrived data\n    }\n});\n```\n\n## API\n\n> TBD, but compatible with [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws).\n\n## Issue Reporting\n\nIf you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public [GitHub issue tracker](https://github.com/MikeBild/subscriptions-transport-sse/issues).\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.\n\n## Thanks\n\nYou like this __subscriptions-transport-sse__ and you want to see what coming next? Follow me on Twitter [`@mikebild`](https://twitter.com/mikebild).\n\nEnjoy!\n","readmeFilename":"README.md"}