File js on vpn server

0

I have a dilemma, I'm working a char with sokect.io this is my .js

let express = require('express')
let app = express();

let http = require('http');
let server = http.Server(app);

let socketIO = require('socket.io');
let io = socketIO(server);

const port = process.env.PORT || 3000;

io.on('connection', (socket) => {
    console.log('user connected',socket.id);
   // io.emit('new_message',socket.id);


    socket.on('new_message', (message) => {
            io.emit('new_message',message);
            //socket.broadcast.to(message).emit('new_message',message);
            console.log( 'el mensaje emitido '+message);
        });

    socket.on('disconnect', function(){
        console.log('user disconnected');
    });
});

server.listen(port, () => {
    console.log('started on port: ${port}');
});

everything fine because I run it in the terminal so node index.js and he is listening in the port 3000 ..

Now my dilemma is how I upload it to the server and what route would I be listening to ?????

    
asked by j.dow 03.11.2017 в 16:23
source

1 answer

0

Obviously you will be listening in:

  

[server ip]: 3000

You must make sure to open port 3000 as TCP for inbound and outbound, otherwise it will not be possible to exchange traffic with clients.

    
answered by 04.11.2017 в 15:10