When you start, it gives an entry on the screen and this is how it hangs. I tried to change the port, I tried to fix something in the code, but it started when I moved the site to another server and the domain was also redirected to another ip. Server code is published below.
var PORT = 8008; var options = { // 'log level': 0 }; var mysql = require('mysql'); var connection = mysql.createConnection({ host : '****', user : '****', password : '****', database : '****' }); connection.connect(); var express = require('express'); var app = express(); var http = require('http'); var server = http.createServer(app); var io = require('socket.io').listen(server, options); server.listen(PORT); app.use('/static', express.static(__dirname + '/static')); app.get('/', function (req, res) { res.sendfile(__dirname + '/index.html'); }); io.sockets.on('connection', function (client) { client.on('message', function (message,id_my,id_you,id_you_book,komy) { try { client.emit('message'+message.id_you, message); client.broadcast.emit('message'+message.id_you, message); var post = {my_id: message.id_my, you_id: message.id_you_book, text: message.text, book: message.id_you, komy: message.komy, type: 5, date: new Date()}; var query = connection.query('INSERT INTO comment SET ?', post, function(err, result) { console.log('ΠΠΎΠ±Π°Π²Π»Π΅Π½ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ ΠΊ ΠΊΠ½ΠΈΠ³Π΅'); }); } catch (e) { console.log(e); client.disconnect(); connection.end(); } }); client.on('stena', function (stena,id_my,id_you) { try { client.emit('stena'+stena.id_you, stena); client.broadcast.emit('stena'+stena.id_you, stena); var post = {users2: stena.id_my, text: stena.text, users: stena.id_you, type: 3, date: new Date()}; var query = connection.query('INSERT INTO repost SET ?', post, function(err, result) { console.log('ΠΠΎΠ±Π°Π²Π»Π΅Π½Π° Π·Π°ΠΏΠΈΡΡ Π½Π° ΡΡΠ΅Π½Ρ'); }); } catch (e) { console.log(e); client.disconnect(); connection.end(); } }); client.on('comment', function (comment,id_my,id_you,id_you_post,komy) { try { client.emit('comment'+comment.id_you, comment); client.broadcast.emit('comment'+comment.id_you, comment); var post = {my_id: comment.id_my, you_id: comment.id_you_post, text: comment.text, post: comment.id_you, komy: comment.komy, type: 4, date: new Date()}; var query = connection.query('INSERT INTO comment SET ?', post, function(err, result) { console.log('ΠΠΎΠ±Π°Π²Π»Π΅Π½ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ ΠΊ Π·Π°ΠΏΠΈΡΠ΅'); }); } catch (e) { console.log(e); client.disconnect(); connection.end(); } }); client.on('art', function (art,id_my,id_you,id_you_art,komy) { try { client.emit('art'+art.id_you, art); client.broadcast.emit('art'+art.id_you, art); var post = {my_id: art.id_my, you_id: art.id_you_art, text: art.text, art: art.id_you, komy: art.komy, type: 6, date: new Date()}; var query = connection.query('INSERT INTO comment SET ?', post, function(err, result) { console.log('ΠΠΎΠ±Π°Π²Π»Π΅Π½ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ ΠΊ Π°ΡΡΡ'); }); } catch (e) { console.log(e); client.disconnect(); connection.end(); } }); client.on('chat', function (chat) { try { client.emit(chat.id, chat); client.broadcast.emit(chat.id, chat); var post = {dialog: chat.id, text: chat.text, users: chat.my, status: 1, date: new Date()}; var query = connection.query('INSERT INTO chat SET ?', post, function(err, result) { console.log('ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΎ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅'); }); } catch (e) { console.log(e); client.disconnect(); connection.end(); } }); });
vds
if not a secret? - Vladimir Gamalyan