{"id":19142244,"url":"https://github.com/eldoy/wsrecon","last_synced_at":"2026-06-10T18:30:17.197Z","repository":{"id":57400107,"uuid":"144458406","full_name":"eldoy/wsrecon","owner":"eldoy","description":"Isomorphic implementation of an automatically reconnecting websocket client.","archived":false,"fork":false,"pushed_at":"2021-05-22T15:25:13.000Z","size":424,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-03T16:40:06.667Z","etag":null,"topics":["browser","client","isomorphic","javascript","reconnecting-websocket","spa","websocket"],"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/eldoy.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":"2018-08-12T10:44:30.000Z","updated_at":"2022-06-04T21:52:06.000Z","dependencies_parsed_at":"2022-09-05T03:01:11.879Z","dependency_job_id":null,"html_url":"https://github.com/eldoy/wsrecon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwsrecon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwsrecon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwsrecon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwsrecon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/wsrecon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240223216,"owners_count":19767598,"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":["browser","client","isomorphic","javascript","reconnecting-websocket","spa","websocket"],"created_at":"2024-11-09T07:26:28.978Z","updated_at":"2026-06-10T18:30:17.157Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reconnecting Websocket\n\nImplementation of an isomorphic automatically reconnecting websocket client.\n\nMessage format is JSON. Works perfectly with Node.js servers, script or Server Side Rendering.\n\n### Install\n```\nnpm i wsrecon\n```\n\n### Usage\nThe client wraps the normal WebSocket browser client or uses the ws Node.js client if not in the browser.\n\n```js\nconst client = require('wsrecon')\n\n// Awaits the connection ready\nconst socket = await client('ws://localhost:6000', {\n  // Reconnect timeout in ms, set to false to not automatically reconnect\n  timeout: 1\n})\n\n// Register events like this\nsocket.on('open', (event) =\u003e {\n  console.log('Connection open')\n})\n\nsocket.on('close', (event) =\u003e {\n  console.log('Connection closed')\n})\n\nsocket.on('error', (event) =\u003e {\n  console.log('Connection error')\n})\n\n// Data from server arrives here automatically JSON parsed\nsocket.on('message', (data, event) =\u003e {\n  console.log('Received message', data)\n})\n\n// Send message, data arrives in message event\nsocket.send({ hello: 'socket' })\n```\n\nMIT licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fwsrecon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fwsrecon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fwsrecon/lists"}