{"id":23449523,"url":"https://github.com/danielmahon/nexus-plugin-subscriptions","last_synced_at":"2025-04-13T18:51:37.531Z","repository":{"id":39375280,"uuid":"262413172","full_name":"danielmahon/nexus-plugin-subscriptions","owner":"danielmahon","description":"Nexus plugin to support GraphQL subscriptions","archived":false,"fork":false,"pushed_at":"2023-01-06T05:21:03.000Z","size":2113,"stargazers_count":5,"open_issues_count":17,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T09:40:51.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nexus-plugin-subscriptions","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/danielmahon.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":"2020-05-08T19:38:59.000Z","updated_at":"2023-05-09T04:45:14.000Z","dependencies_parsed_at":"2023-02-05T10:01:00.807Z","dependency_job_id":null,"html_url":"https://github.com/danielmahon/nexus-plugin-subscriptions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fnexus-plugin-subscriptions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fnexus-plugin-subscriptions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fnexus-plugin-subscriptions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fnexus-plugin-subscriptions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielmahon","download_url":"https://codeload.github.com/danielmahon/nexus-plugin-subscriptions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248765983,"owners_count":21158296,"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","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-12-23T23:19:25.000Z","updated_at":"2025-04-13T18:51:37.506Z","avatar_url":"https://github.com/danielmahon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nexus-plugin-subscriptions \u003c!-- omit in toc --\u003e\n\n**Contents**\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Installation](#installation)\n- [Example Usage](#example-usage)\n- [Runtime Contributions](#runtime-contributions)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\u003cbr\u003e\n\n## Installation\n\n```\nnpm install nexus-plugin-subscriptions\n```\n\n## Example Usage\n\n```ts\n// app.ts\n\nimport { use, server, log } from 'nexus';\nimport { PrismaClient } from 'nexus-plugin-prisma/client';\nimport { subscriptions } from 'nexus-plugin-subscriptions';\n// Your context handler\nimport { createContext } from './context';\n\nconst db = new PrismaClient();\n\n// Nexus plugins\nuse(\n  subscriptions({\n    ws: { server: server.raw.http, path: '/subscriptions' },\n    keepAlive: 10 * 1000,\n    onConnect: async (payload: Record\u003cstring, any\u003e) =\u003e {\n      log.info('client connected');\n      return await createContext(payload['authorization'], { db });\n    },\n    onDisconnect: () =\u003e {\n      log.info('client disconnected');\n    },\n  })\n);\n```\n\n## Runtime Contributions\n\nProvides your generated schema to `nexus-plugin-subscriptions`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmahon%2Fnexus-plugin-subscriptions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielmahon%2Fnexus-plugin-subscriptions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmahon%2Fnexus-plugin-subscriptions/lists"}