{"id":24567325,"url":"https://github.com/autonomoussoftware/websocket-reconnector","last_synced_at":"2025-03-17T03:41:07.995Z","repository":{"id":72034010,"uuid":"147574833","full_name":"autonomoussoftware/websocket-reconnector","owner":"autonomoussoftware","description":"A wrapper to W3C WebSocket objects to seamlesly add reconnection feature","archived":false,"fork":false,"pushed_at":"2020-03-06T13:48:24.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-25T12:41:15.984Z","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/autonomoussoftware.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":"2018-09-05T20:19:27.000Z","updated_at":"2020-03-06T13:48:33.000Z","dependencies_parsed_at":"2023-06-14T16:30:29.732Z","dependency_job_id":null,"html_url":"https://github.com/autonomoussoftware/websocket-reconnector","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fwebsocket-reconnector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fwebsocket-reconnector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fwebsocket-reconnector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fwebsocket-reconnector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autonomoussoftware","download_url":"https://codeload.github.com/autonomoussoftware/websocket-reconnector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971157,"owners_count":20376785,"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-01-23T13:17:47.608Z","updated_at":"2025-03-17T03:41:07.978Z","avatar_url":"https://github.com/autonomoussoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# websocket-reconnector\n\n[![Build Status](https://travis-ci.com/autonomoussoftware/websocket-reconnector.svg?branch=master)](https://travis-ci.com/autonomoussoftware/websocket-reconnector)\n\nA wrapper to W3C WebSocket objects to seamlesly add reconnection feature.\n\n## Installation\n\n```bash\n$ npm install --save websocket-reconnector\n```\n\n## Usage\n\n```js\nconst WebSocketReconnector = require('websocket-reconnector')\n\n// Wrap any W3C WebSocket implementation\nconst ReconnectingWebSocket = WebSocketReconnector(WebSocket)\n\n// Create your WebSocket client as usual and attach events\nconst client = ReconnectingWebsocket('ws://localhost')\n\n// On connection and one every reconnection, send a message\nclient.onopen(() =\u003e client.send('Hello server'))\n\n// A response is always received, no need to resubscribe to events\nclient.onmessage(event =\u003e console.log(`Message received: ${event.data}`))\n```\n\n### API\n\nThe API is fully compatible with the [W3C WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) API.\n\nIn addition, the following additional method is available:\n\n#### `client.reconnect()`\n\nCloses the underlying websocket instance and initiates a new connection.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomoussoftware%2Fwebsocket-reconnector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautonomoussoftware%2Fwebsocket-reconnector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomoussoftware%2Fwebsocket-reconnector/lists"}