Transport Polling Error Socket.io (using Heroku)












0














I've been trying to create a chat app hosted on heroku using node.js and socket.io. I got the app running on heroku, but continually get this error:



index.js:83 GET http://localhost:3000/socket.io/? 
EIO=3&transport=polling&t=MRvty6h net::ERR_CONNECTION_REFUSED


Here's my server stuff:



var express  = require('express');
var socketio = require('socket.io');
var http = require('http');

var app = express();
var server = http.createServer(app);
var io = socketio(server);

var webroot = __dirname + '/client';
var port = 3000;

app.use('/', express.static(webroot));


server.listen(process.env.PORT || port, function(){
console.log('hosting from' + webroot);
console.log('server listening on http://localhost:' + port + '/')
});


I've looked all over, and I've tried everything I've found to no avail.



EDIT



I have realized something now. My server.js is configured on a heroku dyno and starts, but doesn't appear to actually be running (although the logs show no indication it stopped running. Am I missing something, or is heroku just being kinda dumb? Strangely enough, though, it seems that if I run server.js on my machine locally the app works on heroku...










share|improve this question
























  • Your client should not be requesting localhost:3000 when your app is running on heroku.
    – Patrick Roberts
    Nov 12 '18 at 0:02
















0














I've been trying to create a chat app hosted on heroku using node.js and socket.io. I got the app running on heroku, but continually get this error:



index.js:83 GET http://localhost:3000/socket.io/? 
EIO=3&transport=polling&t=MRvty6h net::ERR_CONNECTION_REFUSED


Here's my server stuff:



var express  = require('express');
var socketio = require('socket.io');
var http = require('http');

var app = express();
var server = http.createServer(app);
var io = socketio(server);

var webroot = __dirname + '/client';
var port = 3000;

app.use('/', express.static(webroot));


server.listen(process.env.PORT || port, function(){
console.log('hosting from' + webroot);
console.log('server listening on http://localhost:' + port + '/')
});


I've looked all over, and I've tried everything I've found to no avail.



EDIT



I have realized something now. My server.js is configured on a heroku dyno and starts, but doesn't appear to actually be running (although the logs show no indication it stopped running. Am I missing something, or is heroku just being kinda dumb? Strangely enough, though, it seems that if I run server.js on my machine locally the app works on heroku...










share|improve this question
























  • Your client should not be requesting localhost:3000 when your app is running on heroku.
    – Patrick Roberts
    Nov 12 '18 at 0:02














0












0








0







I've been trying to create a chat app hosted on heroku using node.js and socket.io. I got the app running on heroku, but continually get this error:



index.js:83 GET http://localhost:3000/socket.io/? 
EIO=3&transport=polling&t=MRvty6h net::ERR_CONNECTION_REFUSED


Here's my server stuff:



var express  = require('express');
var socketio = require('socket.io');
var http = require('http');

var app = express();
var server = http.createServer(app);
var io = socketio(server);

var webroot = __dirname + '/client';
var port = 3000;

app.use('/', express.static(webroot));


server.listen(process.env.PORT || port, function(){
console.log('hosting from' + webroot);
console.log('server listening on http://localhost:' + port + '/')
});


I've looked all over, and I've tried everything I've found to no avail.



EDIT



I have realized something now. My server.js is configured on a heroku dyno and starts, but doesn't appear to actually be running (although the logs show no indication it stopped running. Am I missing something, or is heroku just being kinda dumb? Strangely enough, though, it seems that if I run server.js on my machine locally the app works on heroku...










share|improve this question















I've been trying to create a chat app hosted on heroku using node.js and socket.io. I got the app running on heroku, but continually get this error:



index.js:83 GET http://localhost:3000/socket.io/? 
EIO=3&transport=polling&t=MRvty6h net::ERR_CONNECTION_REFUSED


Here's my server stuff:



var express  = require('express');
var socketio = require('socket.io');
var http = require('http');

var app = express();
var server = http.createServer(app);
var io = socketio(server);

var webroot = __dirname + '/client';
var port = 3000;

app.use('/', express.static(webroot));


server.listen(process.env.PORT || port, function(){
console.log('hosting from' + webroot);
console.log('server listening on http://localhost:' + port + '/')
});


I've looked all over, and I've tried everything I've found to no avail.



EDIT



I have realized something now. My server.js is configured on a heroku dyno and starts, but doesn't appear to actually be running (although the logs show no indication it stopped running. Am I missing something, or is heroku just being kinda dumb? Strangely enough, though, it seems that if I run server.js on my machine locally the app works on heroku...







javascript node.js heroku socket.io






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 '18 at 23:53

























asked Nov 9 '18 at 20:14









Ben Keefe

11




11












  • Your client should not be requesting localhost:3000 when your app is running on heroku.
    – Patrick Roberts
    Nov 12 '18 at 0:02


















  • Your client should not be requesting localhost:3000 when your app is running on heroku.
    – Patrick Roberts
    Nov 12 '18 at 0:02
















Your client should not be requesting localhost:3000 when your app is running on heroku.
– Patrick Roberts
Nov 12 '18 at 0:02




Your client should not be requesting localhost:3000 when your app is running on heroku.
– Patrick Roberts
Nov 12 '18 at 0:02

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232718%2ftransport-polling-error-socket-io-using-heroku%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232718%2ftransport-polling-error-socket-io-using-heroku%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

Bicuculline

さくらももこ