{"id":21569990,"url":"https://github.com/itsuki-hayashi/rtcdc","last_synced_at":"2026-05-17T19:32:17.329Z","repository":{"id":143907115,"uuid":"170854357","full_name":"itsuki-hayashi/rtcdc","owner":"itsuki-hayashi","description":"A modernized wrapper for WebRTC data channels.","archived":false,"fork":false,"pushed_at":"2023-10-25T03:55:35.000Z","size":129,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T03:10:01.769Z","etag":null,"topics":["browser","datachannel","messaging","realtime","realtime-messaging","typescript","web","webrtc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/itsuki-hayashi.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":"2019-02-15T11:27:02.000Z","updated_at":"2023-03-04T05:28:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ee20794-0d33-4477-b13f-2715c2ae1686","html_url":"https://github.com/itsuki-hayashi/rtcdc","commit_stats":null,"previous_names":["edsgerlin/rtcdc","itsuki-hayashi/rtcdc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itsuki-hayashi/rtcdc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsuki-hayashi%2Frtcdc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsuki-hayashi%2Frtcdc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsuki-hayashi%2Frtcdc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsuki-hayashi%2Frtcdc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsuki-hayashi","download_url":"https://codeload.github.com/itsuki-hayashi/rtcdc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsuki-hayashi%2Frtcdc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260359668,"owners_count":22997341,"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","datachannel","messaging","realtime","realtime-messaging","typescript","web","webrtc"],"created_at":"2024-11-24T11:11:19.060Z","updated_at":"2026-05-17T19:32:12.307Z","avatar_url":"https://github.com/itsuki-hayashi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rtcdc\nA modernized wrapper for WebRTC data channels.\n\n# Features\n* Simple API for creating WebRTC data channel.\n* Works in Chrome \u0026 Firefox, some workarounds are required for Safari support (Due to buggy data channel implementation in Safari 12).\n* Binary \u0026 text data.\n* RxJs-based messaging interface.\n* Native TypeScript support.\n* Use vanilla ICE for signalling.\n* Native Promise-based interface.\n\n# Install\nnpm install rtcdc --save\n\n# Usage\n\nYou might need a web bundler (e.g. Rollup, Webpack, Browserify) for it to work.\n\n```javascript\nimport { Offerer, Answerer } from 'rtcdc';\n\nasync function main() {\n    const offerer = new Offerer();\n    const offer = await Offerer.createOffer(); // Create WebRTC offer.\n    \n    // Now send your offer to another peer (answerer).\n    const answerer = new Answerer();\n    const answer = await answerer.createAnswer(offer); // Get WebRTC answer based on the offer we got.\n    \n    // Send answer back to the offerer.\n    await offerer.setAnswer(answer);\n\n    // Get data channels.\n    const answererDataChannel = await answerer.getDataChannel();\n    const offererDataChannel = await offerer.getDataChannel();\n\n    // Test the data channel.\n    answererDataChannel.messages.subscribe((message) =\u003e console.log(`Answerer got: ${message}.`))\n    offererDataChannel.messages.subscribe((message) =\u003e console.log(`Offerer got: ${message}.`))\n    await answererDataChannel.send('ping'); // Offerer got: ping.\n    await offererDataChannel.send('pong'); // Answerer got: pong.\n}\nmain().then();\n```\n\nYou can also override the configuration to suit your needs, e.g. you will need to configure TURN server to connect peers behind symmetric NAT.\nReference: https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration\n\n```javascript\nconst config = {\n    iceServers: [{\n        urls: \"stun:stun.services.mozilla.com\",\n        username: \"louis@mozilla.com\", \n        credential: \"webrtcdemo\"\n    }, {\n        urls: [\"stun:stun.example.com\", \"stun:stun-1.example.com\"]\n    }]\n};\nconst offerer = new Offerer(config);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsuki-hayashi%2Frtcdc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsuki-hayashi%2Frtcdc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsuki-hayashi%2Frtcdc/lists"}