I'm trying to run a nodejs application with express and socket.io on heroku and it comess out with this error
EACCESS, Permission denied
when i try to run following code:
app.configure(function () {
app.set('port', process.env.PORT || 3000);
});
var server = http.createServer(app).listen(app.get('port'))
io = require('socket.io').listen(server); // it crashes on this line
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
io.set("log level", 1);
});
Is it even possible to do this on heroku?
dependencies:
"socket.io": "*",
"express": "3.0.0rc4",
Check this link: using socket.io with node.js on heroku.
[UPDATE 1]
Check this answer, which I think can help you troubleshooting your problem.
[UPDATE 2]
A link to a question that has working code (regardless of the client's bug, the motivation of the question itself).
var port = process.env.PORT || 3000;
var app = require('express').createServer()
var io = require('socket.io').listen(app);
app.listen(port);
// Heroku setting for long polling
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});
// To set handlers for data received, etc ... use io.sockets.on('...', ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With