How to start a chat (node.js, socket.io) on the website?

Try to run the chat example on the website socket.io.

server.js:

var express = require('express');
var app = express();
var server = app.listen(3000);
var io = require('socket.io')(server);

io.on('connection', function(socket){
socket.emit('an event sent to all connected clients');

console.log('a user connected');
socket.on('disconnect', function(){
console.log('user disconnected');
});
socket.on('chat message', function(msg){
io.emit('chat message', msg);
console.log('message:' + msg);
});
});

start:
node server.js &

netstat-lnp -t
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 9429/node

as far as I know - everything is normal, 3000 the port is listening.
try from a browser:
mydomen.com:3000
not loaded.
on the host - Service: Virtual server / OpenVZ
Where that not so?
July 9th 19 at 13:29
2 answers
July 9th 19 at 13:31
Solution
Solved!
the problem was the server ordered the port in faerie.
July 9th 19 at 13:33
What do you expect to get? You are doing chat from exemple socket.io, why not use all what is written there?

https://github.com/socketio/socket.io/blob/master/...

Since you're not yet versed in what they are doing.
do everything as written socket.io/get-started/chat, gradually understand. came to the first test - launched the server part,
launch the browser mydomen.com:3000 - not working(((
can server what's wrong?
prompt please to the beginner - Letitia_Okuneva commented on July 9th 19 at 13:36
You have nothing to boot, in your code, no html which need or can be given via the WEB. See the difference in your code. How did you decide that firewall ω in General is not clear. - Joshua97 commented on July 9th 19 at 13:39

Find more questions by tags Node.jsSocket.io