{"id":35771771,"url":"https://github.com/f1ndev/react-io-client","last_synced_at":"2026-02-28T23:01:01.201Z","repository":{"id":65549264,"uuid":"584224529","full_name":"f1ndev/react-io-client","owner":"f1ndev","description":"A socket.io-client hook for react built with Typescript.","archived":false,"fork":false,"pushed_at":"2023-06-14T00:52:51.000Z","size":149,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T20:35:58.074Z","etag":null,"topics":["react-hooks","socket-io","socket-io-client"],"latest_commit_sha":null,"homepage":"https://f1n.dev/react-io-client/","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/f1ndev.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}},"created_at":"2023-01-01T22:37:06.000Z","updated_at":"2023-06-18T22:37:09.000Z","dependencies_parsed_at":"2024-09-25T02:02:07.559Z","dependency_job_id":null,"html_url":"https://github.com/f1ndev/react-io-client","commit_stats":null,"previous_names":["finneasles/react-io-client"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/f1ndev/react-io-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1ndev%2Freact-io-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1ndev%2Freact-io-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1ndev%2Freact-io-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1ndev%2Freact-io-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f1ndev","download_url":"https://codeload.github.com/f1ndev/react-io-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1ndev%2Freact-io-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29954583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["react-hooks","socket-io","socket-io-client"],"created_at":"2026-01-07T04:40:36.139Z","updated_at":"2026-02-28T23:01:01.190Z","avatar_url":"https://github.com/f1ndev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-io-client\n\n[![thumbnail](https://repository-images.githubusercontent.com/584224529/39430953-efa7-4b46-b0c7-f89491303b53)](https://i.imgur.com/Ob4qAwu.png)\n\n\u003e Note: The socket connection does not come with any event handlers. Those should be added and managed by the component that use this hook. [More information](https://f1n.dev/react-io-client/).\n\n## Getting Started\n\nInstall dependency:\n\n```bash\nnpm i react-io-client\n```\n\n### Example\n\nHere's an example of how to use the useSocket hook in a React component:\n\n```js\nimport { useSocket } from  \"react-io-client\";\nimport  React, { useEffect, useState } from  \"react\";\n\nexport  default  function  Chat() {\nconst [socket] = useSocket(\"ws://localhost:3000\", { autoConnect:  false });\nconst [messages, setMessages] = useState([]);\n\nuseEffect(() =\u003e {\nif (!socket) return;\nsocket.on(\"message\", (message: string) =\u003e {\nsetMessages((prevMessages) =\u003e [...prevMessages, message]);\n});\nsocket.emit(\"join\", \"room1\");\nreturn () =\u003e {\nsocket.off(\"message\");\nsocket.emit(\"leave\", \"room1\");\n};\n}, [socket]);\n\nreturn messages.map((message, index) =\u003e {\nreturn \u003cdiv  key={index}\u003e{message}\u003c/div\u003e;\n});\n}\n```\n\n## Learn More\n\n* The hook must be wrapped in a useEffect to avoid memory leaks.\n\nYou can learn more in the [Documentation](https://f1n.dev/react-io-client).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff1ndev%2Freact-io-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff1ndev%2Freact-io-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff1ndev%2Freact-io-client/lists"}