{"id":20858227,"url":"https://github.com/agamnentzar/ag-sockets","last_synced_at":"2025-10-19T04:34:39.121Z","repository":{"id":74192728,"uuid":"54919952","full_name":"Agamnentzar/ag-sockets","owner":"Agamnentzar","description":"Library for communication via WebSockets","archived":false,"fork":false,"pushed_at":"2025-04-30T14:38:11.000Z","size":927,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-23T05:56:59.203Z","etag":null,"topics":["communication","javascript-library","typescript","websockets"],"latest_commit_sha":null,"homepage":null,"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/Agamnentzar.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2016-03-28T20:03:20.000Z","updated_at":"2025-04-30T14:38:15.000Z","dependencies_parsed_at":"2025-05-12T22:32:22.709Z","dependency_job_id":"3fdcef92-2e41-4eee-b7cc-03372b718f23","html_url":"https://github.com/Agamnentzar/ag-sockets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Agamnentzar/ag-sockets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agamnentzar%2Fag-sockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agamnentzar%2Fag-sockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agamnentzar%2Fag-sockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agamnentzar%2Fag-sockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Agamnentzar","download_url":"https://codeload.github.com/Agamnentzar/ag-sockets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agamnentzar%2Fag-sockets/sbom","scorecard":{"id":9192,"data":{"date":"2025-08-11","repo":{"name":"github.com/Agamnentzar/ag-sockets","commit":"a0fc1233c7ef4266117ea7ad32d4e2b32019231d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"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 'master'"],"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":"Vulnerabilities","score":0,"reason":"21 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","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","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"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-14T14:11:22.510Z","repository_id":74192728,"created_at":"2025-08-14T14:11:22.510Z","updated_at":"2025-08-14T14:11:22.510Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274032454,"owners_count":25210787,"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-09-07T02:00:09.463Z","response_time":67,"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":["communication","javascript-library","typescript","websockets"],"created_at":"2024-11-18T04:45:08.318Z","updated_at":"2025-10-19T04:34:34.083Z","avatar_url":"https://github.com/Agamnentzar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ag-sockets\n\n[![Build Status](https://travis-ci.org/Agamnentzar/ag-sockets.svg)](https://travis-ci.org/Agamnentzar/ag-sockets)\n[![npm version](https://badge.fury.io/js/ag-sockets.svg)](https://badge.fury.io/js/ag-sockets)\n\nLibrary for communication via WebSockets\n\n## Installation\n\n```bash\nnpm install ag-sockets\nnpm install ws # peer dependency\n```\n\n## Usage\n\n### Using with [µWebSockets](https://github.com/uWebSockets/uWebSockets)\n\n```\nnpm install uws\n```\n\n```typescript\nimport * as uws from 'uws';\nimport { createServer } from 'ag-sockets';\n\n// ...\nconst wsServer = createServer(..., { ws: uws, arrayBuffer: true });\n```\n\n### Set up sockets\n\n#### Common interfaces\n\n```typescript\n// interfaces.ts\n\nimport { SocketClient, SocketServer } from 'ag-sockets';\n\nexport interface IExampleClient extends SocketClient {\n  message(name: string, message: string);\n}\n\nexport interface IExampleServer extends SocketServer {\n  connected(): void;\n  diconnected(): void;\n  broadcast(message: string): void;\n  setName(name: string): void;\n}\n```\n\n#### Client object\n\n```typescript\n// client.ts\n\nimport { Method } from 'ag-sockets';\nimport { IExampleClient, IExampleServer } from './interfaces';\n\nexport class ExampleClient implements IExampleClient {\n  constructor(private server: IExampleServer) {\n  }\n  connected() {\n    this.server.setName('John');\n    this.server.broadcast('Hello!');\n  }\n  @Method()\n  message(name: string, message: string) {\n    console.log(`${name}: ${message}`);\n  }\n}\n```\n\n#### Server object\n\n```typescript\n// server.ts\n\nimport { Method, Socket, ClientExtensions } from 'ag-sockets';\nimport { IExampleClient, IExampleServer } from './interfaces';\n\nconst clients: ExampleClient[] = [];\n\n@Socket({ path: '/test' })\nexport class ExampleServer implements IExampleServer {\n  private name: string;\n  constructor(private client: IExampleClient \u0026 ClientExtensions) {\n  }\n  connected() {\n    clients.push(this.client);\n  }\n  disconnected() {\n    clients.splice(clients.indexOf(this.client), 1);\n  }\n  @Method() // annotations are optional if all class methods are to be available\n  broadcast(message: string) {\n    clients.forEach(c =\u003e c.message(this.name, message));\n  }\n  @Method()\n  setName(name: string) {\n    this.name = name;\n  }\n}\n```\n\n#### Start server\n\n```typescript\nimport * as http from 'http';\nimport { createServer } from 'ag-sockets';\nimport { ExampleClient } from './client';\nimport { ExampleServer } from './server';\n\nconst server = http.createServer();\nconst wsServer = createServer(server, ExampleServer, ExampleClient, client =\u003e new Server(client));\n\n// pass 'wsServer.options()' to client side\n\nserver.listen(12345, () =\u003e console.log('server listening...'));\n```\n\n#### Connect client\n\n```typescript\nimport { createClientSocket } from 'ag-sockets';\nimport { ExampleClient } from './client';\nimport { IExampleClient, IExampleServer } from './interfaces';\n\nconst options = // get 'wsServer.options()' from server side\nconst service = createClientSocket\u003cIExampleClient, IExampleServer\u003e(options);\nservice.client = new ExampleClient(service.server);\nservice.connect();\n```\n\n### Binary communication\n\n```typescript\nexport const enum Bin {\n\tI8,\n\tU8,\n\tI16,\n\tU16,\n\tI32,\n\tU32,\n\tF32,\n\tF64,\n\tBool,\n\tStr,\n\tObj,\n}\n\n// examples\n\nclass Client {\n\t@Method({ binary: [Bin.I32, Bin.Str] })\n\tfoo(a: number, b: string) {\n\t}\n\t@Method({ binary: [[Bin.I32], [Bin.I32, Bin.I32, Bin.I32]] })\n\tbar(a: number[], b: [number, number, number][]) {\n\t}\n\t@Method({ binary: [[Bin.F32], Bin.Obj] })\n\tboo(a: number[], b: any) {\n\t}\n}\n```\n\n## Development\n\n```bash\ngulp build          # build production version of code\n\ngulp dev            # build and start watch tasks\ngulp dev --tests    # build and start watch tasks with tests\ngulp dev --coverage # build and start watch tasks with tests and code coverage\n\ngulp lint           # typescript lint\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagamnentzar%2Fag-sockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagamnentzar%2Fag-sockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagamnentzar%2Fag-sockets/lists"}