javascript - Node.JS TCP STUN server not receiving connection from RTCPeerConnection -
i've been doing localized testing on webkitrtcpeerconnection
in chrome 43, , running local tcp server in node.js receive stun packets peers. client code (for local testing) follows:
// chrome var iceservers = { iceservers: [{ url: "stun:localhost:8080" }] }, optional = { optional: [{ dtlssrtpkeyagreement: true }, { rtpdatachannels: true }] }, peer1 = new webkitrtcpeerconnection(iceservers, optional), peer2 = new webkitrtcpeerconnection(iceservers, optional); peer1.createoffer(function(offer) { peer1.setlocaldescription(offer); peer2.setremotedescription(offer); peer2.createanswer(function(answer) { peer1.setremotedescription(answer); }); });
my node.js tcp socket server meant receive stun packet , log now. tcp stun server outlined in rfc 5389. here's code it:
var net = require('net'), options = { allowhalfopen: true }, port = 8080, server = net.createserver(options, connectionlistener); server.listen(port, listening); function connectionlistener(connection) { var data = ''; console.log('connection opened'); connection.setencoding('utf8'); connection.on('data', function (buffer) { console.log('data received'); data += buffer; }); connection.on('end', function () { console.log('data stream ended'); connection.end(); console.log('----\n%s\n----', data); }); } function listening() { console.log('listening on port %d', port); }
when client code finishes running, peer1.iceconnectionstate
"checking"
, , peer1.icegatheringstate
, peer2.iceconnectionstate
, peer2.icegatheringstate
remain "new"
. nothing logs on tcp server except listening on port 8080
. can tell me why no connection opened if peer1.iceconnectionstate
"checking"
?
Comments
Post a Comment