{"id":20997589,"url":"https://github.com/setsun/realtime","last_synced_at":"2026-04-21T22:32:54.046Z","repository":{"id":97727758,"uuid":"252078980","full_name":"setsun/realtime","owner":"setsun","description":"A signaling server \u0026 web client for WebRTC","archived":false,"fork":false,"pushed_at":"2024-10-10T01:32:47.000Z","size":42,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-20T09:12:43.866Z","etag":null,"topics":["peer-to-peer","signaling-server","webrtc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/setsun.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":"2020-04-01T05:17:38.000Z","updated_at":"2023-11-24T22:20:14.000Z","dependencies_parsed_at":"2023-11-24T23:23:37.461Z","dependency_job_id":null,"html_url":"https://github.com/setsun/realtime","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/setsun%2Frealtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setsun%2Frealtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setsun%2Frealtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setsun%2Frealtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/setsun","download_url":"https://codeload.github.com/setsun/realtime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243410491,"owners_count":20286424,"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":["peer-to-peer","signaling-server","webrtc"],"created_at":"2024-11-19T07:40:48.487Z","updated_at":"2025-12-29T22:39:41.716Z","avatar_url":"https://github.com/setsun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# realtime\n\n\u003e 🚧 Documentation \u0026 stable implementation in progress 🚧\n\nA signaling server \u0026 web client for WebRTC.\n\nThe goal of this library is to absorb some of the complexity of WebRTC, and handle negotiating the connection between two peers, allowing the direct transfer of any arbitrary data between the two peers. This may be well-suited for video chat, game data updates, or other applications that require real-time performance.\n\nIt handles this through some of the following:\n\n- Exchanging [`RTCPeerConnection` offers](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer) between peers.\n- Exchanging [`RTCPeerConnection` answers](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createAnswer) between peers.\n- Exchanging [ICE candidates](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addIceCandidate) between peers.\n- Creating [data channels](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createDataChannel) to send arbitrary JSON data through the peer connection.\n\n## API\n\n### SignalingEvents\nSignaling events are the set of events that `realtime` uses internally for connecting two peers via WebRTC.\n\nThe static types for the event types / event payloads are shared across the client and server.\n\n```tsx\nenum SignalingEvents {\n  Initialize = \"Initialize\",\n  UserConnected = \"UserConnected\",\n  UserDisconnected = \"UserDisconnected\",\n  SendOffer = \"SendOffer\",\n  ReceiveOffer = \"ReceiveOffer\",\n  SendAnswer = \"SendAnswer\",\n  ReceiveAnswer = \"ReceiveAnswer\",\n  SendCandidate = \"SendCandidate\",\n  ReceiveCandidate = \"ReceiveCandidate\",\n}\n```\n\n### SignalingServer\nThe signaling server is responsible for negotiating a `RTCPeerConnection` between 2 clients. Once the peer connection is established, all data is sent between the two clients without the need of the intermediate server.\n\n#### Example\n```tsx\nimport { SignalingServer } from \"@raycaster/realtime\";\nimport { createServer } from \"http\";\n\n// attach the signaling server to the top-level http server\nconst httpServer = createServer();\nconst signalingServer = new SignalingServer({ server: httpServer });\n\nhttpServer.listen(3000);\n```\n\n### RTCClient\nThe RTC client is meant to be used in the browser, and initiates a connection request through the included signaling server to another peer. Once the connection is established, the two peers are able to send data directly to each other.\n\n#### Example\n```tsx\nimport { RTCClient } from \"@raycaster/realtime\";\n\nconst client = new RTCClient({ url: 'ws://localhost:3000' });\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetsun%2Frealtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetsun%2Frealtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetsun%2Frealtime/lists"}