title: Socket.io disconnecting
body: <p>I have a chat done in nodejs, Express, socket.io and angular. It works well but disconnects sometimes and at random times. Generally the connection lasts no more than 2 minutes. I get several net :: ERR_CONNECTION_TIMED_OUT on the console.</p>
  
  <p>PS.: I'm using apache 2.2 on CentOS with certified ssl.
  Any tips? </p>
  
  <p>My server.js header is below</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>#!/bin/env node
  
  var express = require('express'),
  path = require('path'),
  app = express(),
  logger = require('morgan'),
  _m = require("./models/Message"),
  Message = _m.m,
  NewMessage = _m.n,
  Group = _m.g,
  Online = _m.o,
  DeletedMessage = _m.d,
  LastMessage = _m.l,
  _mTASK = require("./models/Task"),
  _Task = _mTASK.t,
  TaskComment = _mTASK.c,
  TaskLog = _mTASK.l,
  TaskModel = _mTASK.m,
  TaskNotification = _mTASK.n,
  _d = require("./lib/Connection");
  
  app.use(logger('dev'));
  app.set('port', 3000);
  app.set('ipaddr', "127.0.0.1");
  
  var server = require('http').createServer(app);
  
  // catch 404 and forward to error handler
  app.use(function(req, res, next) {
      var err = new Error('Not Found');
      err.status = 404;
      next(err);
  });
  
  if (app.get('env') === 'development') {
      app.use(function(err, req, res, next) {
          res.status(err.status || 500);
          res.render('error', {
              message: err.message,
              error: err
          });
      });
  }
  
  // production error handler
  // no stacktraces leaked to user
  app.use(function(err, req, res, next) {
      res.status(err.status || 500);
      res.render('error', {
          message: err.message,
          error: {}
      });
  });
  
  server.listen(app.get('port'), app.get('ipaddr'), function() {
      console.log('Express server listening on  IP: ' + app.get('ipaddr') + ' and port ' + app.get('port'));
  });
  
  
  var io = require("socket.io")(server);
  
  io.set("origins", 'https://meusite.me:*');
  io.set('transports', ['polling', 'websocket']);</code></pre>
  </div>
  </div>
  </p>