Answer the question
In order to leave comments, you need to log in
How to run a chat (node.js, socket.io) on a website?
I'm trying to start the chat from the example on the socket.io site.
server.js:
var express = require('express');
var app = express();
varserver = 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 );
});
});
I run:
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 9429/node
as far as I understand - everything is fine, port 3000 is listening.
I try from the browser:
mydomen.com:3000
is not loaded.
on the host - Service: Virtual server / OpenVZ
Where is it?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question