title: Heroku + Node.js + Peer.js (webrtc): Failed to load resource: net::ERR_CONNECTION_REFUSED
body: <p>I can't to connect from client script:</p>
  
  <pre><code>this.Peer = new Peer({host: PEER_SERVER_ADDR, 
  port: PEER_PORT_ADDR, //at this context: 30028
  path: PEER_PATH_ADDR,
  debug: true,
  config:{'iceServers'[{urls:'stun:stun.l.google.com:19302'}  ]}
  });
  </code></pre>
  
  <p>to peer signal server:</p>
  
  <pre><code>var express = require("express");
  var ExpressPeerServer = require("peer").ExpressPeerServer;
  var bodyParser = require("body-parser");
  var urlencodedParser = bodyParser.urlencoded({extended: false});
  var jsonParser = bodyParser.json();
  //var BodyParser = require("body-parser"); 
  
  var const_and_funcs = require("./vk_space_chat_constants_and_general_functions.js");
  var app = express();
  var heroku_port = process.env.PORT || const_and_funcs.PEER_PORT_ADDR; //:30028
  var server = app.listen(heroku_port);
  console.log(heroku_port);
  console.log(const_and_funcs.PEER_PATH_ADDR + " ");
  
  var options = {
      debug: true
  };
  
  var peerServer = ExpressPeerServer(server, options);
  app.use(const_and_funcs.PEER_PATH_ADDR, peerServer);
  app.use(jsonParser);
  app.use(urlencodedParser);
  </code></pre>
  
  <p>But when I'm trying to connect to server, I have this problem:</p>
  
  <pre><code>h t t p s :// My_App.herokuapp.com:30028/vk_space_chat/peerjs/id?ts=14850577089420.5386418990500108 
  Failed to load resource: net::ERR_CONNECTION_REFUSED
  peer.min.js:1 PeerJS:  ERROR Error retrieving ID undefined
  peer.min.js:1 PeerJS:  ERROR Aborting!
  peer.min.js:1 PeerJS:  ERROR Error: Could not get an ID from the server.
  peer.min.js:1 PeerJS:  ERROR Error retrieving ID ProgressEvent
  peer.min.js:1 PeerJS:  ERROR Aborting!
  peer.min.js:1 PeerJS:  ERROR Error: Could not get an ID from the server.
  </code></pre>
  
  <p>But the same code works at my local Node.js server!!! Without problems!
  Can anyone help me?.. 
  Maybe there is a problem with WebSockets?..
  Or maybe that will be better to use normal VPS?</p>