title: video chat application on node.js with webRTC( socket.io) works fine on localhost but gives error on network
body: <p>I am making a video chat application on node.js with WebRTC(socket.io). This application runs fine on localhost but gives error while running on my network with my IP address. Also, I tried it on Heroku but error remained same</p>
  <hr />
  <p>Only Top of my server looks like</p>
  <pre><code>   const express = require(&quot;express&quot;);
      const socket = require(&quot;socket.io&quot;);
      const app = express();
      
      //Starts the server
      
      let server = app.listen(process.env.PORT||4000, function () {
        console.log(&quot;Server is running&quot;);
      });
      
      app.use(express.static(__dirname+&quot;/public&quot;));
      
      //Upgrades the server to accept websockets.
      
      let io = socket(server);
      
      //Triggered when a client is connected.
      
      io.on(&quot;connection&quot;, function (socket) {
        console.log(&quot;User Connected :&quot; + socket.id);
  </code></pre>
  <hr />
  <p>Top part of client side is</p>
  <pre><code>let socket = io.connect(&quot;//192.168.1.73:4000&quot;);
  let divVideoChatLobby = document.getElementById(&quot;video-chat-lobby&quot;);
  let divVideoChat = document.getElementById(&quot;video-chat-room&quot;);
  let joinButton = document.getElementById(&quot;join&quot;);
  let userVideo = document.getElementById(&quot;user-video&quot;);
  let peerVideo = document.getElementById(&quot;peer-video&quot;);
  let roomInput = document.getElementById(&quot;roomName&quot;);
  let roomName;
  let creator = false;
  let rtcPeerConnection;
  let userStream;
  
  // Contains the stun server URL we will be using.
  let iceServers = {
    iceServers: [
      { urls: &quot;stun:stun.services.mozilla.com&quot;},
      { urls: &quot;stun:stun.l.google.com:19302&quot;},
    ],
  };
  </code></pre>
  <hr />
  <p>Error on running on running server on 192.168.1.73:4000 is</p>
  <pre><code>chat.js:37 Uncaught TypeError: Cannot read property 'getUserMedia' of undefined
  
      at f.&lt;anonymous&gt; (chat.js:37)
      at f.r.emit (socket.io-3.0.1.min.js:6)
      at f.value (socket.io-3.0.1.min.js:6)
      at f.value (socket.io-3.0.1.min.js:6)
      at f.value (socket.io-3.0.1.min.js:6)
      at b.&lt;anonymous&gt; (socket.io-3.0.1.min.js:6)
      at b.r.emit (socket.io-3.0.1.min.js:6)
      at b.value (socket.io-3.0.1.min.js:6)
      at n.&lt;anonymous&gt; (socket.io-3.0.1.min.js:6)
      at n.r.emit (socket.io-3.0.1.min.js:6)
  
  (anonymous) @ chat.js:37
  r.emit @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  (anonymous) @ socket.io-3.0.1.min.js:6
  r.emit @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  (anonymous) @ socket.io-3.0.1.min.js:6
  r.emit @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  (anonymous) @ socket.io-3.0.1.min.js:6
  r.emit @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  (anonymous) @ socket.io-3.0.1.min.js:6
  r.emit @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  value @ socket.io-3.0.1.min.js:6
  ws.onmessage @ socket.io-3.0.1.min.js:6
  </code></pre>
  <hr />
  <p>on Heroku error looks like</p>
  <p>GET <a href="https://projectnepflix.herokuapp.com:4000/socket.io/?EIO=4&amp;transport=polling&amp;t=NVEwhoG" rel="nofollow noreferrer">https://projectnepflix.herokuapp.com:4000/socket.io/?EIO=4&amp;transport=polling&amp;t=NVEwhoG</a> net::ERR_CONNECTION_TIMED_OUT on Chrome</p>
  <p>git repo sample : <a href="https://github.com/innovatoraakash/nepflix" rel="nofollow noreferrer">https://github.com/innovatoraakash/nepflix</a></p>