{"id":18910127,"url":"https://github.com/cretezy/dsock-node","last_synced_at":"2025-08-02T10:12:26.251Z","repository":{"id":91752090,"uuid":"295430662","full_name":"Cretezy/dSock-node","owner":"Cretezy","description":"dSock Node client","archived":false,"fork":false,"pushed_at":"2021-03-10T15:41:07.000Z","size":67,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-01T03:15:18.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cretezy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-14T13:50:02.000Z","updated_at":"2021-03-10T15:41:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"0eeda3de-7057-4317-89eb-9f315daec9f6","html_url":"https://github.com/Cretezy/dSock-node","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Cretezy/dSock-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2FdSock-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2FdSock-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2FdSock-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2FdSock-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cretezy","download_url":"https://codeload.github.com/Cretezy/dSock-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2FdSock-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268370180,"owners_count":24239766,"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-08-02T02:00:12.353Z","response_time":74,"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-11-08T09:41:15.545Z","updated_at":"2025-08-02T10:12:25.856Z","avatar_url":"https://github.com/Cretezy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dSock Node Client\n\nNode client for [dSock](https://github.com/Cretezy/dSock).\n\n[GitHub](https://github.com/Cretezy/dSock-node) - [npm](https://www.npmjs.com/package/dsock)\n\n## Installation\n\n```bash\nnpm install dsock\n# or\nyarn add dsock\n```\n\n## Usage\n\n```ts\nconst { dSockClient } = require(\"dsock\");\n# or\nimport { dSockClient } from \"dsock\";\n\n\nconst dsock = new dSockClient(dSockApiUrl, dSockToken);\n```\n\n### [Create claim](https://github.com/Cretezy/dSock#claims)\n\nCreate a claim for user authentication.\n\n```ts\nconst claim = dsock.createClaim({\n  user: \"user\",\n  // optional\n  session: \"session\",\n  id: \"id\",\n  channels: [\"channel\"],\n  time: { duration: 30 }, // in seconds, or use `expiration` for seconds since epoch\n});\n```\n\n### [Send message](https://github.com/Cretezy/dSock#sending-message)\n\nSend a message to a target (one or many clients).\n\n```ts\nawait dsock.send({\n  data: JSON.stringify({ type: \"hello-world\" }), // any string or Buffer\n  // target (choose one or many)\n  user: \"user\",\n  session: \"session\", // depends on `user\n  id: \"id\",\n  channel: \"channel\",\n});\n```\n\n### [Disconnecting](https://github.com/Cretezy/dSock#disconnecting)\n\nDisconnect a target (one or many clients).\n\n```ts\nawait dsock.disconnect({\n  keepClaims: false, // if to keep claims for target\n  // target (choose one or many)\n  user: \"user\",\n  session: \"session\", // depends on `user\n  id: \"id\",\n  channel: \"channel\",\n});\n```\n\n### [Info](https://github.com/Cretezy/dSock#info)\n\nGet claim and connection info from a target (one or many clients).\n\n```ts\nconst { claims, connections } = await dsock.info({\n  // target (choose one or many)\n  user: \"user\",\n  session: \"session\", // depends on `user\n  id: \"id\",\n  channel: \"channel\",\n});\n```\n\n### [Channels](https://github.com/Cretezy/dSock#channels)\n\nSubscribe/unsubscribe a target to a channel (one or many clients).\n\n```ts\nawait dsock.channelSubscribe(\"new-channel\", {\n  // target (choose one or many)\n  user: \"user\",\n  session: \"session\", // depends on `user\n  id: \"id\",\n  channel: \"channel\",\n});\n\n\nawait dsock.channelUnsubscribe(\"new-channel\", {\n  // target (choose one or many)\n  user: \"user\",\n  session: \"session\", // depends on `user\n  id: \"id\",\n  channel: \"channel\",\n});\n```\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcretezy%2Fdsock-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcretezy%2Fdsock-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcretezy%2Fdsock-node/lists"}