{"id":47686018,"url":"https://github.com/farskid/sockette-component","last_synced_at":"2026-04-02T14:50:24.867Z","repository":{"id":57365605,"uuid":"119907022","full_name":"farskid/sockette-component","owner":"farskid","description":"A react and preact component for handling websockets","archived":false,"fork":false,"pushed_at":"2020-04-09T19:54:16.000Z","size":6,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-28T09:29:26.549Z","etag":null,"topics":["preact","react","react-component","socket","sockette","websocket"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/farskid.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}},"created_at":"2018-02-01T23:39:21.000Z","updated_at":"2021-03-24T01:59:06.000Z","dependencies_parsed_at":"2022-08-23T20:10:45.432Z","dependency_job_id":null,"html_url":"https://github.com/farskid/sockette-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/farskid/sockette-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farskid%2Fsockette-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farskid%2Fsockette-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farskid%2Fsockette-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farskid%2Fsockette-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farskid","download_url":"https://codeload.github.com/farskid/sockette-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farskid%2Fsockette-component/sbom","scorecard":{"id":393075,"data":{"date":"2025-08-11","repo":{"name":"github.com/farskid/sockette-component","commit":"a8431da50038d01ff7b602e7ad2346d71ef4a552"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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 0/2 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":"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 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-18T18:18:56.748Z","repository_id":57365605,"created_at":"2025-08-18T18:18:56.749Z","updated_at":"2025-08-18T18:18:56.749Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31308446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["preact","react","react-component","socket","sockette","websocket"],"created_at":"2026-04-02T14:50:23.979Z","updated_at":"2026-04-02T14:50:24.859Z","avatar_url":"https://github.com/farskid.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sockette-component [![NPM](https://img.shields.io/npm/v/sockette-component.svg)](https://www.npmjs.com/package/sockette-component)\n\n\u003e A (367 byte gzip) [Sockette](https://github.com/lukeed/sockette) component for React and Preact\n\n\u003e Note: This is a component factory for binding [Lukeed's sockette library](https://github.com/lukeed/sockette) to react and preact.\n\nThis is a very light component that exposes `sockette`'s [API](https://github.com/lukeed/sockette#api) via component properties.\n\nPlease note that (1) nothing is rendered to the DOM and (2) the `WebSocket` is closed before unmounting!\n\nThis module exposes three module definitions:\n\n* **ES Module**: `dist/sockette-component.es.js`\n* **CommonJS**: `dist/sockette-component.js`\n* **UMD**: `dist/sockette-component.min.js`\n\nIf using the UMD bundle, the library is exposed as `socketteComponent` globally.\n\n## Install\n\n```\n$ npm install --save sockette-component\n```\n\n## Usage\n\n_Quick example that wraps Sockette within a custom component._\n\n### Using with **React**\n\n```js\nimport { Component, createElement } from \"react\";\nimport createSocket from \"sockette-component\";\n\nconst Sockette = createSocket({\n  Component,\n  createElement\n});\n\nclass Foobar extends Component {\n  state = {\n    socket: null\n  };\n\n  onOpen = ev =\u003e {\n    console.log(\"\u003e Connected!\", ev);\n  };\n\n  onMessage = ev =\u003e {\n    console.log(\"\u003e Received:\", ev.data);\n  };\n\n  onReconnect = ev =\u003e {\n    console.log(\"\u003e Reconnecting...\", ev);\n  };\n\n  sendMessage = _ =\u003e {\n    // WebSocket available in state!\n    this.state.ws.send(\"Hello, world!\");\n  };\n\n  render() {\n    return (\n      \u003cdiv class=\"demo\"\u003e\n        \u003cbutton onClick={this.sendMessage}\u003eSEND\u003c/button\u003e\n\n        \u003cSockette\n          url=\"wss://...\"\n          getSocket={socket =\u003e {\n            this.setState({socket});\n          }}\n          maxAttempts={25}\n          onopen={this.onOpen}\n          onmessage={this.onMessage}\n          onreconnect={this.onReconnect}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n### Using with **Preact**\n\n```js\nimport { h, Component } from \"preact\";\nimport Sockette from \"sockette-component\";\n\nconst Sockette = createSocket({\n  Component,\n  createElement: h\n});\n\nclass Foobar extends Component {\n  state = {\n    socket: null\n  };\n\n  onOpen = ev =\u003e {\n    console.log(\"\u003e Connected!\", ev);\n  };\n\n  onMessage = ev =\u003e {\n    console.log(\"\u003e Received:\", ev.data);\n  };\n\n  onReconnect = ev =\u003e {\n    console.log(\"\u003e Reconnecting...\", ev);\n  };\n\n  sendMessage = _ =\u003e {\n    // WebSocket available in state!\n    this.state.ws.send(\"Hello, world!\");\n  };\n\n  render() {\n    return (\n      \u003cdiv class=\"demo\"\u003e\n        \u003cbutton onClick={this.sendMessage}\u003eSEND\u003c/button\u003e\n\n        \u003cSockette\n          url=\"wss://...\"\n          getSocket={socket =\u003e {\n            this.setState(socket);\n          }}\n          maxAttempts={25}\n          onopen={this.onOpen}\n          onmessage={this.onMessage}\n          onreconnect={this.onReconnect}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n## Properties\n\nPlease see [Sockette's Options](https://github.com/lukeed/sockette#socketteurl-options) \u0026mdash; all `props` are passed _directly_ to `sockette`.\n\n#### url\n\nType: `String`\u003cbr\u003e\n\nThe URL you want to connect to \u0026mdash; see [Sockette's docs](https://github.com/lukeed/sockette#url).\n\n## Context\n\nThe active `WebSocket` is sent on mount of Socket component by calling `getSocket` prop callback. You can save it by any means via providing a `getSocket` prop as shown in the example above. This means that you can programmatically interact with [Sockette's API](https://github.com/lukeed/sockette#api), including `close()`, `reconnect()`, `send()`, etc.\n\nWhen `\u003cSockette/\u003e` is unmounted, the `WebSocket` is closed (`ws.close()`).\n\n## License\n\nMIT © [Farzad YZ](http://farzadyz.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarskid%2Fsockette-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarskid%2Fsockette-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarskid%2Fsockette-component/lists"}