{"id":22772362,"url":"https://github.com/gautaz/webresock","last_synced_at":"2025-03-30T12:27:16.593Z","repository":{"id":58243116,"uuid":"69944062","full_name":"gautaz/webresock","owner":"gautaz","description":"Yet another reconnecting WebSocket using reconnect-core","archived":false,"fork":false,"pushed_at":"2016-10-05T20:45:09.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T15:02:14.137Z","etag":null,"topics":["backoff-strategy","reconnection","websocket","websocket-reconnection"],"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/gautaz.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":"2016-10-04T07:48:38.000Z","updated_at":"2017-05-16T16:51:42.000Z","dependencies_parsed_at":"2022-08-31T01:01:41.991Z","dependency_job_id":null,"html_url":"https://github.com/gautaz/webresock","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautaz%2Fwebresock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautaz%2Fwebresock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautaz%2Fwebresock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautaz%2Fwebresock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gautaz","download_url":"https://codeload.github.com/gautaz/webresock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246317971,"owners_count":20758073,"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":["backoff-strategy","reconnection","websocket","websocket-reconnection"],"created_at":"2024-12-11T17:08:15.156Z","updated_at":"2025-03-30T12:27:16.571Z","avatar_url":"https://github.com/gautaz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webresock\n\nYet another client-side reconnecting WebSocket.\n\nThis one is using [reconnect-core][2].\n\n## Why?\n\n[ReconnectingWebSocket][3] already exists so why bothering?\n\n[ReconnectingWebSocket][3] is great but it only allows a backoff strategy using [a predictable reconnection time interval](https://github.com/joewalnes/reconnecting-websocket#reconnectinterval).\nThis means that if 100.000 clients are connected to your websocket server, when it fails and starts over again, it will face 100.000 connection attempts at once.\n\n[webresock][1] tries to fix this issue by providing a way to choose alternate backoff strategies which eventually distribute the clients connection attempts.\n\n## How?\n\n[webresock][1] uses [reconnect-core][2] to handle the WebSocket reconnection in case of a temporary server failure.\n\nIn order to use [webresock][1], get the package through bower:\n\n```bash\nbower install --save webresock\n```\n\nAnd use it:\n\n```html\n\u003cscript src=\"webresock.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  webresock.reconnect({\n    // reconnect-core options\n    strategy: new webresock.backoff.Backoff({\n      // backoff strategy\n    })\n  })\n  .on('connect', (ws) =\u003e ws\n    .on('message', console.log)\n  )\n  .connect('ws://whatever')\n\u003c/script\u003e\n```\n\n## Contributing\n\nI'm open to discussing and merging any PR as long as my schedule allows it.\n\n\n\nBefore sending any PR, ensure that `npm test` still succeeds.\nIn case of a new feature, ensure that tests are extended accordingly.\n\n## References\n\n[1]: https://github.com/gautaz/webresock\n[2]: https://github.com/juliangruber/reconnect-core\n[3]: https://github.com/joewalnes/reconnecting-websocket\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgautaz%2Fwebresock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgautaz%2Fwebresock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgautaz%2Fwebresock/lists"}