{"id":15597122,"url":"https://github.com/alorel/ngx-sails","last_synced_at":"2025-04-28T10:49:57.128Z","repository":{"id":35104862,"uuid":"206754442","full_name":"Alorel/ngx-sails","owner":"Alorel","description":"Angular bindings for communicating with the sails backend","archived":false,"fork":false,"pushed_at":"2024-02-20T19:09:38.000Z","size":3171,"stargazers_count":4,"open_issues_count":10,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T23:38:36.301Z","etag":null,"topics":["angular","bindings","ngx","sails","socket-io","socket-io-client"],"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/Alorel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2019-09-06T08:56:20.000Z","updated_at":"2023-01-24T10:37:08.000Z","dependencies_parsed_at":"2023-02-15T08:46:19.638Z","dependency_job_id":"ad64f29c-dac0-4e32-bf42-b98bb44e6e3e","html_url":"https://github.com/Alorel/ngx-sails","commit_stats":{"total_commits":104,"total_committers":6,"mean_commits":"17.333333333333332","dds":0.5576923076923077,"last_synced_commit":"9324b3062093eae44896f5fa1c7844b8d55ca549"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alorel%2Fngx-sails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alorel%2Fngx-sails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alorel%2Fngx-sails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alorel%2Fngx-sails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alorel","download_url":"https://codeload.github.com/Alorel/ngx-sails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251299557,"owners_count":21567246,"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":["angular","bindings","ngx","sails","socket-io","socket-io-client"],"created_at":"2024-10-03T01:20:32.032Z","updated_at":"2025-04-28T10:49:57.103Z","avatar_url":"https://github.com/Alorel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular bindings for the sails socket client\n\nUsed the abandoned [ngx-sails](https://github.com/brandom/ngx-sails) as a base.\n\n## Installation\n\n- `npm install socket.io-client@^2.0.0`\n- `npm install @aloreljs/ngx-sails@CHECK_BELOW`:\n   - Angular 16: ^4.0.0\n   - 15: ^3.0.0\n   - 14: ^2.1.0\n   - 13: ^2.0.0\n\n## Configuration\n\nThe following injection tokens can be included in your app module to configure the client:\n\nProvide an existing socket.io instance:\n\n```typescript\nimport {IO_INSTANCE} from '@aloreljs/ngx-sails';\n\n@NgModule({\n  providers: [{\n    provide: IO_INSTANCE,\n    useValue: someIoRef\n  }]\n})\nexport class AppModule {}\n```\n\nProvide client configuration:\n\n```typescript\nimport {NGX_SAILS_CONFIG, NgxSailsConfig} from '@aloreljs/ngx-sails';\n\nconst config: NgxSailsConfig = {\n  uri: '/foo',\n  // socket.io options\n  options: {\n  \n  },\n  // default headers\n  headers: {\n  \n  }\n}\n\n@NgModule({\n  providers: [{\n    provide: NGX_SAILS_CONFIG,\n    useValue: config\n  }]\n})\nexport class AppModule {}\n```\n\n## Usage\n\n```typescript\nimport {SailsClient} from '@aloreljs/ngx-sails';\n\n@Component({})\nexport class MyComponent {\n  public constructor(private readonly sails: SailsClient) {}\n\n  public listenForEvent(): void {\n    this.sails.on('eventName').subscribe(response =\u003e {});\n  }\n \n  public makeRequest(): void {\n    this.sails.get('url').subscribe();\n    this.sails.post('url', {foo: 'bar'}).subscribe(response =\u003e {});\n  }\n\n  public emitEventWithoutAResponse(): void {\n    this.sails.emit('eventName', 'arg1', 'arg2');\n  }\n\n  public emitEventWithAResponse(): void {\n    this.sails.emitAndWait('eventName', 'arg1', 'arg2').subscribe(response =\u003e {})\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falorel%2Fngx-sails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falorel%2Fngx-sails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falorel%2Fngx-sails/lists"}