I have webrtc node server like as below.
var WebSocketServer = require('websocket').server;
var http = require('http');
var server = http.createServer(function(request, response) {
// process HTTP request. Since we're writing just WebSockets server
// we don't have to implement anything.
});
server.listen(1337, function() { });
// create the server
wsServer = new WebSocketServer({
httpServer: server
});
// WebSocket server
wsServer.on('request', function(request) {
var connection = request.accept(null, request.origin);
// This is the most important callback for us, we'll handle
// all messages from users here.
connection.on('message', function(message) {
if (message.type === 'utf8') {
// process WebSocket message
}
});
connection.on('close', function(connection) {
// close user connection
});
});
I wonder that which port range is used by node server. We can see one port in the code (1337). But i think node server uses one more port or port range because of video stream. How can i learn which ports are used by webrtc node server.
The Node.js server does not use any additional ports for media. It is a signalling server which only relays session information(SDP exchange, ICE, etc.) and does not relay any media.
If the media was to be relayed by anything, it would be a TURN server but that would be determined by your ICE server set up.
Now, if you are handling media in a peerconnection on the same server as you are signalling, you can grab the port that the media is being streamed to the peerconnection from the SDP.