{"id":29266704,"url":"https://github.com/dimdengd/recowebsocket","last_synced_at":"2025-07-04T16:13:16.205Z","repository":{"id":270045123,"uuid":"909181522","full_name":"dimdenGD/recowebsocket","owner":"dimdenGD","description":"WebSocket with automatic reconnection.","archived":false,"fork":false,"pushed_at":"2024-12-28T22:45:27.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T06:16:48.432Z","etag":null,"topics":[],"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/dimdenGD.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":"2024-12-28T00:23:13.000Z","updated_at":"2025-05-06T12:04:00.000Z","dependencies_parsed_at":"2024-12-28T00:27:14.632Z","dependency_job_id":"4e6331e4-185a-44f9-9ae4-45a7d911e900","html_url":"https://github.com/dimdenGD/recowebsocket","commit_stats":null,"previous_names":["dimdengd/recowebsocket"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dimdenGD/recowebsocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimdenGD%2Frecowebsocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimdenGD%2Frecowebsocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimdenGD%2Frecowebsocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimdenGD%2Frecowebsocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimdenGD","download_url":"https://codeload.github.com/dimdenGD/recowebsocket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimdenGD%2Frecowebsocket/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263575325,"owners_count":23483054,"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":[],"created_at":"2025-07-04T16:13:14.983Z","updated_at":"2025-07-04T16:13:16.199Z","avatar_url":"https://github.com/dimdenGD.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RecoWebSocket\n\nWebSocket with automatic reconnection. Just a wrapper around `ws` Client with a bunch of new options.\n\n## Installation\n\n```bash\nnpm install recowebsocket\n```\n\n## Usage\n\nEverything is the same as in `ws` Client, but with `reconnect`, `reconnectInterval`, `reconnectMaxAttempts` options. All events you attached will be automatically attached to the underlying `ws` Client, even on reconnect. Set `reconnectMaxAttempts` to `-1` to reconnect indefinitely.\n\n```js\nimport WebSocket from \"recowebsocket\";\n\nconst ws = new WebSocket(\"wss://echo.websocket.org\", {\n  // these are the default values\n  reconnect: true,\n  reconnectInterval: 1000,\n  reconnectMaxAttempts: -1,\n});\n\nws.on(\"open\", () =\u003e {\n  console.log(\"Connected to the server\");\n  ws.send(\"Hello, server!\");\n});\n```\n\nCalling `ws.close()` or `ws.terminate()` will close the underlying `ws` Client and stop reconnecting.\n\nThere's also additional nice method `ws.json(data, options)`, which will stringify data and send it as a JSON.\n\n## Caveats\n\n- Not all event emitter methods are supported. Only `on`, `once` and `off` are supported. `once` will be called once on each reconnect. So it's not actually once I guess.\n- Some obscure ws client stuff might not work.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimdengd%2Frecowebsocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimdengd%2Frecowebsocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimdengd%2Frecowebsocket/lists"}