chat part working quite seemlessly with heroku server and database

- fixed many issues with keeping connection alive, avatars, userId, etc.
This commit is contained in:
Arjun Patel
2018-07-27 23:59:11 -07:00
parent e27d1db7ec
commit d6dfcd1994
6 changed files with 115 additions and 58 deletions
+13 -4
View File
@@ -4,10 +4,10 @@ var io = require('socket.io')(server);
var mysql = require('mysql');
var con = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'mysql',
database: 'nexto'
host: 'us-cdbr-iron-east-04.cleardb.net',
user: 'bc7fa7fdf1822b',
password: 'f62b55b3',
database: 'heroku_99e764eb3c2ab7e'
});
var port = 3000;
@@ -61,4 +61,13 @@ io.on('connection', function (socket) {
socket.on('disconnect', function() {
console.log('Client disconnected: ' + socket.id);
});
connection.on('error', function (err) {
if (!err.fatal) {
return;
}
if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
throw err;
}
});
});