1

これが私のセットアップです

サーバ

var webrtcServer = new PeerServer({
    port: 9000,
    path: "/wrtc"
});

ピア 1 (node-webkit アプリケーション内で実行)

var peer = new Peer( 'masterName', {
    host: 'localhost',
    port: 9000,
    path: '/wrtc'
});

peer.on( 'connection', function(conn) {
    conn.on( 'open', function() {
        console.log( "peer connected" );          // This fires as expected
        conn.send( "helo" );
    });
});

ピア 2 (ブラウザー内で実行)

conn = peer.connect('masterName');
conn.on('open', function(){
    console.log( "WebRTC connection open" );      // This fires as expected
});

conn.on('data', function(data) { 
    debugger; 
    console.log("data");                          // This never hits
}); 

peer.js にブレークポイントを設定すると、データが受信されません。接続を信頼できるように設定しても、何も変わりません。他に試せることはありますか?

4

1 に答える 1

2

同様の問題に遭遇し、STUNサーバーを追加すると解決しました。また、peerjs Google グループでのこのディスカッションもご覧ください。

peer = new Peer(
        {
          host: 'localhost',
          port: 9000,
          debug: true,
          config: { 'iceServers': [
            { 'url': 'stun:stun.l.google.com:19302' }  
          ] }
        });
于 2014-06-23T09:07:30.817 に答える