# lib-js-wildPeerConnection **Repository Path**: wilddogio/lib-js-wildPeerConnection ## Basic Information - **Project Name**: lib-js-wildPeerConnection - **Description**: 同步自 https://github.com/WildDogTeam/lib-js-wildPeerConnection - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-07 - **Last Updated**: 2026-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wild-peerconnection RTCPeerConnection 的封装,使用Wilddog作为signaling channel. webrtc 的一大问题是p2p之间的连接建立需要第三方服务器的支持.Wilddog提供实时后端服务,是webrtc的理想signaling channel ## 安装 ``` npm install wild-peerconnection ``` ## 使用 发送端 ```js var ref = new Wilddog('https://.wilddogio.com/SOMEPATH1'); //本端mailbox的地址 var remoteRef = new Wilddog('https://.wilddogio.com/SOMEPATH2');//对端mailbox的地址 var peer = new WildPeerConnection(ref,remoteRef,config);//config 会直接传给RTCPeerConnection navigator.getUserMedia({"video":true},function(stream){ peer.addStream(stream) }) ``` 接收端 ```js var ref = new Wilddog('https://.wilddogio.com/SOMEPATH2'); //本端mailbox的地址 var remoteRef = new Wilddog('https://.wilddogio.com/SOMEPATH1');//对端mailbox的地址 var peer = new WildPeerConnection(ref,remoteRef,config); peer.on('addstream',function(stream){ view.src = URL.createObjectURL(stream); //view 是