Reputation: 3826
I'm currently writing a chat application which will run on Heroku. I'm using Node.JS and Socket.IO for this task. It works perfectly when I run it locally but when I deploy it to heroku I get this error :
app[web.1]: /app/node_modules/socket.io/lib/manager.js:724
app[web.1]: rand.writeInt32BE(this.sequenceNumber, 11);
app[web.1]: ^
app[web.1]: TypeError: Object
Here's the Socket.IO part of the code (the rest is just classic Express code) :
var socket = require('socket.io');
var io = socket.listen(app);
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});
var usernames = {}
io.sockets.on('connection', function (socket) {
socket.on('adduser', function(username) {
socket.username = username;
usernames[username] = username;
socket.join('room');
socket.emit('action', username, 'connected');
socket.broadcast.to('room').emit('action', username, 'connected');
});
socket.on('message', function(message) {
socket.emit('message', socket.username, message);
socket.broadcast.to('room').emit('message', socket.username, message);
});
});
Has anyone got any idea on how to solve this bug ?
Upvotes: 0
Views: 108
Reputation: 10864
Make sure you are using right version of node and npm specified in package.json
"engines": {
"node": "0.8.x"
,"npm": "1.1.x"
}
Upvotes: 1