{"id":19066507,"url":"https://github.com/geut/socket-signal-websocket","last_synced_at":"2025-04-28T12:29:26.348Z","repository":{"id":54665970,"uuid":"247532048","full_name":"geut/socket-signal-websocket","owner":"geut","description":"socket-signal through simple-websocket","archived":false,"fork":false,"pushed_at":"2022-03-29T15:19:12.000Z","size":2963,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T16:16:58.855Z","etag":null,"topics":["reconnecting-websocket","simple-websocket","socket-signal","webrtc","websocket"],"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/geut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-15T18:59:56.000Z","updated_at":"2021-10-06T23:05:49.000Z","dependencies_parsed_at":"2022-08-13T23:20:11.321Z","dependency_job_id":null,"html_url":"https://github.com/geut/socket-signal-websocket","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fsocket-signal-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fsocket-signal-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fsocket-signal-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fsocket-signal-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geut","download_url":"https://codeload.github.com/geut/socket-signal-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251313220,"owners_count":21569380,"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":["reconnecting-websocket","simple-websocket","socket-signal","webrtc","websocket"],"created_at":"2024-11-09T00:57:07.408Z","updated_at":"2025-04-28T12:29:26.301Z","avatar_url":"https://github.com/geut.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socket-signal-websocket\n\n[![Build Status](https://travis-ci.com/geut/socket-signal-websocket.svg?branch=master)](https://travis-ci.com/geut/socket-signal-websocket)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\n\u003e socket-signal through simple-websocket and reconnecting support\n\n## \u003ca name=\"install\"\u003e\u003c/a\u003e Install\n\n```\n$ npm install socket-signal-websocket\n```\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003e Usage\n\n### Server\n\n```\n$ npx socket-signal-websocket [--port=4000]\n```\n\n### Client\n\n```javascript\nconst { SocketSignalWebsocketClient } = require('socket-signal-websocket')\n\n// you can define multiple server urls for fallback reconnections\nconst client = new SocketSignalWebsocketClient([\n  'ws://localhost:4000',\n  'ws://localhost:4001',\n  'ws://localhost:4002'\n], {\n  heartbeat: {\n    interval: 10 * 1000,\n    timeout: 5 * 1000\n  },\n  simpleWebsocket: {}, // https://github.com/feross/simple-websocket options\n  reconnectingWebsocket: {}, // https://github.com/pladaria/reconnecting-websocket options\n  simplePeer: {} // https://github.com/feross/simple-peer options\n})\n\n;(async () =\u003e {\n  await client.open()\n\n  client.onIncomingPeer(async (peer) =\u003e {\n    if (validPeer(peer)) return\n    throw new Error('invalid peer')\n  })\n\n  const peersForThatTopic = await client.join(topic)\n\n  const remotePeer = client.connect(topic, peersForThatTopic[0])\n\n  try {\n    await remotePeer.ready()\n    // SimplePeer connected\n  } catch(err) {\n    // SimplePeer rejected\n  }\n})()\n```\n\n## \u003ca name=\"issues\"\u003e\u003c/a\u003e Issues\n\n:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/socket-signal-websocket/issues). Please specify your OS and the actions to reproduce it.\n\n## \u003ca name=\"contribute\"\u003e\u003c/a\u003e Contributing\n\n:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/socket-signal-websocket/blob/master/CONTRIBUTING.md).\n\n## License\n\nMIT © A [**GEUT**](http://geutstudio.com/) project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeut%2Fsocket-signal-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeut%2Fsocket-signal-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeut%2Fsocket-signal-websocket/lists"}