{"id":13447627,"url":"https://github.com/joewalnes/reconnecting-websocket","last_synced_at":"2026-10-19T00:12:41.658Z","repository":{"id":2325098,"uuid":"3285927","full_name":"joewalnes/reconnecting-websocket","owner":"joewalnes","description":"A small decorator for the JavaScript WebSocket API that automatically reconnects","archived":false,"fork":false,"pushed_at":"2022-07-26T18:35:34.000Z","size":94,"stargazers_count":4317,"open_issues_count":79,"forks_count":951,"subscribers_count":122,"default_branch":"master","last_synced_at":"2026-10-14T16:17:01.965Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joewalnes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-27T20:28:51.000Z","updated_at":"2026-10-13T20:48:16.000Z","dependencies_parsed_at":"2022-06-27T01:31:31.057Z","dependency_job_id":null,"html_url":"https://github.com/joewalnes/reconnecting-websocket","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/joewalnes/reconnecting-websocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewalnes%2Freconnecting-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewalnes%2Freconnecting-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewalnes%2Freconnecting-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewalnes%2Freconnecting-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joewalnes","download_url":"https://codeload.github.com/joewalnes/reconnecting-websocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewalnes%2Freconnecting-websocket/sbom","scorecard":{"id":527407,"data":{"date":"2025-08-11","repo":{"name":"github.com/joewalnes/reconnecting-websocket","commit":"fd7c819bb15eeee3452c17e317c0a3664c442965"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":4,"reason":"Found 9/20 approved changesets -- score normalized to 4","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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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 19 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-20T04:46:40.184Z","repository_id":2325098,"created_at":"2025-08-20T04:46:40.184Z","updated_at":"2025-08-20T04:46:40.184Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344872684,"owners_count":38336819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-18T02:00:06.448Z","response_time":63,"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-07-31T05:01:22.826Z","updated_at":"2026-10-19T00:12:41.348Z","avatar_url":"https://github.com/joewalnes.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others","Networking and Distributed"],"sub_categories":["Networking"],"readme":"ReconnectingWebSocket\n=====================\n\nA small JavaScript library that decorates the WebSocket API to provide a WebSocket connection that will automatically reconnect if the connection is dropped.\n\nIt is API compatible, so when you have:\n\n```javascript\nvar ws = new WebSocket('ws://....');\n```\n\nyou can replace with:\n\n```javascript\nvar ws = new ReconnectingWebSocket('ws://....');\n```\n\nMinified library with gzip compression is less than 600 bytes.\n\nHow reconnections occur\n-----------------------\n\nWith the standard `WebSocket` API, the events you receive from the WebSocket instance are typically:\n\n    onopen\n    onmessage\n    onmessage\n    onmessage\n    onclose // At this point the WebSocket instance is dead.\n\nWith a `ReconnectingWebSocket`, after an `onclose` event is called it will automatically attempt to reconnect. In addition, a connection is attempted repeatedly (with a small pause) until it succeeds. So the events you receive may look something more like:\n\n    onopen\n    onmessage\n    onmessage\n    onmessage\n    onclose\n    // ReconnectingWebSocket attempts to reconnect\n    onopen\n    onmessage\n    onmessage\n    onmessage\n    onclose\n    // ReconnectingWebSocket attempts to reconnect\n    onopen\n    onmessage\n    onmessage\n    onmessage\n    onclose\n\nThis is all handled automatically for you by the library.\n\n## Parameters\n\n```javascript\nvar socket = new ReconnectingWebSocket(url, protocols, options);\n```\n\n#### `url`\n- The URL you are connecting to.\n- https://html.spec.whatwg.org/multipage/comms.html#network\n\n#### `protocols`\n- Optional string or array of protocols per the WebSocket spec.\n- https://tools.ietf.org/html/rfc6455\n\n#### `options`\n- Options (see below)\n\n## Options\n\nOptions can either be passed as the 3rd parameter upon instantiation or set directly on the object after instantiation:\n\n```javascript\nvar socket = new ReconnectingWebSocket(url, null, {debug: true, reconnectInterval: 3000});\n```\n\nor\n\n```javascript\nvar socket = new ReconnectingWebSocket(url);\nsocket.debug = true;\nsocket.timeoutInterval = 5400;\n```\n\n#### `debug`\n- Whether this instance should log debug messages or not. Debug messages are printed to `console.debug()`.\n- Accepts `true` or `false`\n- Default value: `false`\n\n#### `automaticOpen`\n- Whether or not the websocket should attempt to connect immediately upon instantiation. The socket can be manually opened or closed at any time using ws.open() and ws.close().\n- Accepts `true` or `false`\n- Default value: `true`\n\n#### `reconnectInterval`\n- The number of milliseconds to delay before attempting to reconnect.\n- Accepts `integer`\n- Default: `1000`\n\n#### `maxReconnectInterval`\n- The maximum number of milliseconds to delay a reconnection attempt.\n- Accepts `integer`\n- Default: `30000`\n\n####`reconnectDecay`\n- The rate of increase of the reconnect delay. Allows reconnect attempts to back off when problems persist.\n- Accepts `integer` or `float`\n- Default: `1.5`\n\n#### `timeoutInterval`\n- The maximum time in milliseconds to wait for a connection to succeed before closing and retrying.\n- Accepts `integer`\n- Default: `2000`\n\n#### `maxReconnectAttempts`\n- The maximum number of reconnection attempts that will be made before giving up. If null, reconnection attempts will be continue to be made forever.\n- Accepts `integer` or `null`.\n- Default: `null`\n\n#### `binaryType`\n- The binary type is required by some applications.\n- Accepts strings `'blob'` or `'arraybuffer'`.\n- Default: `'blob'`\n\n---\n\n## Methods\n\n#### `ws.open()`\n- Open the Reconnecting Websocket\n\n#### `ws.close(code, reason)`\n- Closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.\n- `code` is optional the closing code (default value 1000). [https://tools.ietf.org/html/rfc6455#section-7.4.1](https://tools.ietf.org/html/rfc6455#section-7.4.1)\n- `reason` is the optional reason that the socket is being closed. [https://tools.ietf.org/html/rfc6455#section-7.1.6](https://tools.ietf.org/html/rfc6455#section-7.1.6)\n\n#### `ws.refresh()`\n- Refresh the connection if still open (close and then re-open it).\n\n#### `ws.send(data)`\n- Transmits data to the server over the WebSocket connection.\n- Accepts @param data a text string, ArrayBuffer or Blob\n\nLike this? Check out [websocketd](https://github.com/joewalnes/websocketd) for the simplest way to create WebSocket backends from any programming language.\n\n[Follow @joewalnes](https://twitter.com/joewalnes)\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/joewalnes/reconnecting-websocket/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoewalnes%2Freconnecting-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoewalnes%2Freconnecting-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoewalnes%2Freconnecting-websocket/lists"}