{"id":14385256,"url":"https://github.com/angular/ngSocket","last_synced_at":"2025-08-23T18:31:47.550Z","repository":{"id":13504239,"uuid":"16195085","full_name":"angular/ngSocket","owner":"angular","description":"WebSocket support for angular","archived":true,"fork":false,"pushed_at":"2015-06-26T05:42:26.000Z","size":326,"stargazers_count":202,"open_issues_count":15,"forks_count":25,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-08-22T00:57:04.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angular.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-24T04:35:50.000Z","updated_at":"2025-03-04T11:03:51.000Z","dependencies_parsed_at":"2022-09-06T06:41:46.280Z","dependency_job_id":null,"html_url":"https://github.com/angular/ngSocket","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/angular/ngSocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2FngSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2FngSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2FngSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2FngSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angular","download_url":"https://codeload.github.com/angular/ngSocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2FngSocket/sbom","scorecard":{"id":196447,"data":{"date":"2025-08-11","repo":{"name":"github.com/angular/ngSocket","commit":"e381509a505635fce9899ab26526cc44ae11bf0e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"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":"Code-Review","score":0,"reason":"Found 1/28 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":"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":"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":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: 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":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'master'","Warn: branch 'master' does not require approvers","Warn: codeowners review is not required on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Warn: PRs are not required to make changes on branch 'master'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"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":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/angular/.github/SECURITY.md:1","Info: Found linked content: github.com/angular/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/angular/.github/SECURITY.md:1","Info: Found text in security policy: github.com/angular/.github/SECURITY.md:1"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T21:54:43.876Z","repository_id":13504239,"created_at":"2025-08-16T21:54:43.876Z","updated_at":"2025-08-16T21:54:43.876Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271762973,"owners_count":24816843,"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-23T02:00:09.327Z","response_time":69,"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-08-28T18:02:04.000Z","updated_at":"2025-08-23T18:31:47.232Z","avatar_url":"https://github.com/angular.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# ngSocket [![Build Status](https://travis-ci.org/angular/ngSocket.png)](https://travis-ci.org/angular/ngSocket)\n\n## Status: In-Development\n\nAn AngularJS 1.x service for connecting applications to servers with WebSocket support.\n\n## Usage\n\nbower install ngSocket\n\n```javascript\n.controller('SomeController', function (ngSocket) {\n  //Open a WebSocket connection\n  var ws = ngSocket('ws://foo/bar');\n\n  //Can call before socket has opened\n  ws.send({foo: 'bar'});\n});\n```\n\n## API\n\n### Factory: `ngSocket` (in module `ngSocket`)\n\nreturns instance of NGWebSocket\n\n### Methods\n\nname        | arguments                                              | description\n------------|--------------------------------------------------------|------------\nngSocket \u003cbr\u003e_constructor_ | url:String                              | Creates and opens a [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) instance. `var ws = ngSocket('ws://foo');`\nsend        | data:String,Object returns                             | Adds data to a queue, and attempts to send if socket is ready. Accepts string or object, and will stringify objects before sending to socket.\nonMessage   | callback:Function \u003cbr\u003eoptions{filter:String,RegExp, autoApply:Boolean=true} | Register a callback to be fired on every message received from the websocket, or optionally just when the message's `data` property matches the filter provided in the options object. Each message handled will safely call `$rootScope.$digest()` unless `autoApply` is set to `false in the options. Callback gets called with a [MessageEvent](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent?redirectlocale=en-US\u0026redirectslug=WebSockets%2FWebSockets_reference%2FMessageEvent) object.\nonOpen      | callback:Function                                      | Function to be executed each time a socket connection is opened for this instance.\nclose       | force:Boolean:_optional_                               | Close the underlying socket, as long as no data is still being sent from the client. Optionally force close, even if data is still being sent, by passing `true` as the `force` parameter. To check if data is being sent, read the value of `socket.bufferedAmount`.\n\n### Properties\nname               | type             | description\n-------------------|------------------|------------\nsocket             | window.WebSocket | [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) instance.\nsendQueue          | Array\u003cfunction\u003e  | Queue of `send` calls to be made on socket when socket is able to receive data. List is populated by calls to the `send` method, but this array can be spliced if data needs to be manually removed before it's been sent to a socket. Data is removed from the array after it's been sent to the socket.\nonOpenCallbacks    | Array\u003cfunction\u003e  | List of callbacks to be executed when the socket is opened, initially or on re-connection after broken connection. Callbacks should be added to this list through the `onOpen` method.\nonMessageCallbacks | Array\u003cfunction\u003e  | List of callbacks to be executed when a message is received from the socket. Callbacks should be added via the `onMessage` method.\nreadyState         | Number:readonly  | Returns either the readyState value from the underlying WebSocket instance, or a proprietary value representing the internal state of the lib, e.g. if the lib is in a state of re-connecting.\n\n### CancelablePromise\n\nThis type is returned from the `send()` instance method of ngSocket, inherits from [$q.defer().promise](https://docs.angularjs.org/api/ng/service/$q).\n\n### Methods\n\nname        | arguments                                              | description\n------------|--------------------------------------------------------|------------\ncancel      | | Alias to `deferred.reject()`, allows preventing an unsent message from being sent to socket for any arbitrary reason.\nthen        | resolve:Function, reject:Function | Resolves when message has been passed to socket, presuming the socket has a `readyState` of 1. Rejects if the socket is hopelessly disconnected now or in the future (i.e. the library is no longer attempting to reconnect). All messages are immediately rejected when the library has determined that re-establishing a connection is unlikely.\n\n\n### Service: `ngSocketBackend` (in module `ngSocketMock`)\n\nSimilar to [`httpBackend`](http://docs.angularjs.org/api/ngMock.$httpBackend) mock in AngularJS's `ngMock` module\n\n### Methods\n\nname                           | arguments  | description\n-------------------------------|------------|-----------------------------------\nflush                          |            | Executes all pending requests\nexpectConnect                  | url:String | Specify the url of an expected WebSocket connection\nexpectClose                    |            | Expect \"close\" to be called on the WebSocket\nexpectSend                     | msg:String | Expectation of send to be called, with required message\nverifyNoOutstandingExpectation |            | Makes sure all expectations have been satisfied, should be called in afterEach\nverifyNoOutstandingRequest     |            | Makes sure no requests are pending, should be called in afterEach\n\n## Logical Questions\n\n * *Q.*: What if the browser doesn't support WebSockets?\n * *A.*: This module will not help; it does not have a fallback story for browsers that do not support WebSockets.\n\n## Development\n\n```shell\n$ npm install\n$ bower install\n```\n\n### Unit Tests\n`$ npm test` Starts karma and watches files for changes\n\n### Manual Tests\n\nIn the project root directory:\n\n`$ node test-server` Starts a sample web socket server to send/receive messages\n`$ ./node_modules/.bin http-server` - Basic http server to seve a static file\nOpen localhost:8081/test-app.html and watch browser console and node console to see messages passing\n\n### Distribute\n`$ ./dist.sh` For now just copies `src/ngSocket.js` to `dist/` (bower is configured to ignore src/ and test, plus pretty much everything else)\n\n## TODO\n * Automatic re-connection when connection lost\n * Add `onerror` to allow applications to respond to socket errors in their own ways\n * Consider support for ArrayBuffer and Blob datatypes\n * Add `protocols` parameter to constructor\n\n## License\n[Apache 2.0](https://github.com/angular/ngSocket/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular%2FngSocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular%2FngSocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular%2FngSocket/lists"}