I am doing an API and it\'s on Heroku. But I am having some problems with the socket.io only on the heroku side, when I test it in local everything goes fine. The API is com
So there's a couple things here. If you'd like to use Heroku's Websocket service (which is pretty great actually), you're going to need to rework your code to use the einaros/ws implementation of websockets--and then add the service via heroku command line. https://github.com/einaros/ws/blob/master/doc/ws.md
however, since you've already coded your app to socket.io, I would simply rework how you're instantiating the socket.io library:
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server),
server.listen(process.env.PORT || 3000);
This should solve your issue, but let me know what the logs show. I think the hang up is that your app, and your socket are running on two different ports.
After you've created your sever, you can listen for socket events with:
io.sockets.on('connection', function(socket) { //'connection' or any other event
Hope this helps.