webrtc video chat server hosted on heroku

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



webrtc video chat server hosted on heroku



I am trying to build a simple video chat service using webrtc. I am referring to the tutorial given in html5rocks article introducing webrtc basics..[http://www.html5rocks.com/en/tutorials/webrtc/basics/][1]



The server.js is working fine with node-static on the localhost with perfect video streaming and chat service.The problem is when i am trying to host it on heroku ..the video stream doesnt work or should i say none of the functionality of server.js work..Browser window just shows a text box which is the basic layout of my index.html file..So there is definitely some problem in my code .something is missing in server.js file which is required for hosting on heroku..Here is the code for Server.js..Please help me to resolve the issue..Tell me the correct way of hosting it as i know i am missing something here..


var static = require('node-static');
/*var http = require('http');
var file = new(static.Server)();
var app = http.createServer(function (req, res)
file.serve(req, res);
).listen(2013);
*/

var express = require('express');
var app = express();
console.log(express.static(__dirname + '/js'));
app.use(express.static(__dirname + '/js'));
app.all('*', function(req, res)
res.sendfile("index.html");
);

app.listen(9000);


var io = require('socket.io').listen(app);
io.sockets.on('connection', function (socket)

function log()
var array = [">>> "];
for (var i = 0; i < arguments.length; i++)
array.push(arguments[i]);

socket.emit('log', array);


socket.on('message', function (message)
log('Got message: ', message);
socket.broadcast.emit('message', message); // should be room only
);

socket.on('create or join', function (room)
var numClients = io.sockets.clients(room).length;

log('Room ' + room + ' has ' + numClients + ' client(s)');
log('Request to create or join room', room);

if (numClients == 0)
socket.join(room);
socket.emit('created', room);
else if (numClients == 1)
io.sockets.in(room).emit('join', room);
socket.join(room);
socket.emit('joined', room);
else // max two clients
socket.emit('full', room);

socket.emit('emit(): client ' + socket.id + ' joined room ' + room);
socket.broadcast.emit('broadcast(): client ' + socket.id + ' joined room ' + room);

);

);





Post your client side code
– Murugan Pandian
Apr 5 '14 at 10:31





Webrtc video is peer-to-peer. So, probably you will need to check your client code. There is some modules to do that too that you can check: http://easyrtc.com/ and https://github.com/webRTC/webRTC.io
– Scoup
Apr 5 '14 at 15:13





I believe this has something to do with Heroku giving the port to listen through environment variables, and your app is still only available through port 80 from the outside. A wild guess.
– D-side
Feb 5 '15 at 23:03









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard