I'm a beginner at node.js so please bare with me. I have my server at c9.io and have build the easiest chat-application ever:
var http = require('http')
, socketio = require('socket.io');
var server = http.createServer().listen(process.env.PORT, process.env.IP);
socketio.listen(server).on('connection', function (socket) {
socket.on('message', function (msg) {
console.log('Message Received: ', msg);
socket.broadcast.emit('message', msg);
});
});
But I have a problem: After 100 messages, the server just stops! I have to re-run it every time this happens. Is there a way to keep running the server after 100 messages ?