{"id":21961713,"url":"https://github.com/longern/flarepeer","last_synced_at":"2025-03-22T20:27:17.770Z","repository":{"id":249642948,"uuid":"831974393","full_name":"longern/FlarePeer","owner":"longern","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-22T12:48:46.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-28T00:28:25.779Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://longern.github.io/FlarePeer/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/longern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-07-22T05:26:04.000Z","updated_at":"2024-08-22T12:48:49.000Z","dependencies_parsed_at":"2024-08-13T11:38:36.943Z","dependency_job_id":null,"html_url":"https://github.com/longern/FlarePeer","commit_stats":null,"previous_names":["longern/flarepeer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longern%2FFlarePeer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longern%2FFlarePeer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longern%2FFlarePeer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longern%2FFlarePeer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longern","download_url":"https://codeload.github.com/longern/FlarePeer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245017132,"owners_count":20547742,"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":"2024-11-29T10:17:37.119Z","updated_at":"2025-03-22T20:27:17.741Z","avatar_url":"https://github.com/longern.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FlarePeer\n\nFree serverless signalling for WebRTC using Cloudflare Workers and D1.\n\n## Usage \u0026 Example\n\n### Protocol\n\nUse [JSON-RPC 2.0](https://www.jsonrpc.org/specification) over WebSocket.\n\nExample request:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"method\": \"open\",\n  \"params\": { \"key\": \"PEER_API_KEY\" },\n  \"id\": 1\n}\n```\n\nExample response:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"result\": { \"id\": \"xxxx-xxxx\", \"token\": \"TOKEN\" },\n  \"id\": 1\n}\n```\n\n### Methods\n\n```typescript\ninterface FlarePeerClient {\n  open(params?: { key?: string }): Promise\u003c{ id: string; token: string }\u003e;\n\n  reconnect(params: { id: string; token: string }): Promise\u003cvoid\u003e;\n\n  destroy(): Promise\u003cvoid\u003e;\n\n  send(params: {\n    type: \"offer\" | \"answer\" | \"ice-candidate\";\n    id: string;\n    content: string;\n  }): Promise\u003cvoid\u003e;\n\n  poll(): Promise\u003c\n    Array\u003c{\n      type: \"offer\" | \"answer\" | \"ice-candidate\";\n      source: string;\n      content: string;\n    }\u003e\n  \u003e;\n}\n```\n\nSee `example/main.js` for a complete example.\n\n### Demo server\n\nA demo server is available at `wss://peer.longern.com`.\nHowever, it is recommended to host your own server to ensure privacy and reliability.\n\n### Host your own server\n\nCreate a new D1 database and run SQL queries in `src/db.sql`.\n\nCreate a new Workers project and copy `src/worker.js` to the editor.\nSet the following environment variables and deploy.\n\n- `DB`: (Required) D1 database binding.\n- `SECRET_KEY`: (Required) A random secret key.\n- `PEER_API_KEY`: If set, clients must provide this key to connect.\n- `PEER_POLL_INTERVAL`: The minimum interval (ms) between polling. Default is 0.\n- `PEER_MAX_DURATION`: The maximum duration (s) of a connection. If not set, connections will not expire.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongern%2Fflarepeer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongern%2Fflarepeer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongern%2Fflarepeer/lists"}