I have deployed my code but am unable to get socket.io working in production.
I have installed the socket.io node module with the command npm install --save socket.io
Here's the relevant code in my app.js
:
var debug = require('debug')('chat');
var express = require('express');
var app = express();
app.set('port', process.env.PORT || 8080);
var server = app.listen(app.get('port'), 'APP_PRIVATE_IP_ADDRESS', function() {
debug('Express server listening on port ' + server.address().port);
});
var io = require('socket.io')(server);
I am using the browser client
<script src="https://cdn.socket.io/socket.io-1.3.7.js"></script>
Also, the following client code does not print connect:
var socket = io();
socket.on('connect', function(){
console.log('connect');
});
I appreciate any help!