node.js – SOCKET.IO DOES NOT WORK IN PRODUCTION

I've created a socket server with a very simple socket that works very well locally, but trying to put it on an aws redhat server, downloading the necessary dependencies, and opening ports 3000 and 3001 just does not Connected. I entered some logs in the course of the code, the result was the socket starta and start listening on port 3000. But I can not connect. In the following code I tried to use localhost, so that this connection attempt does not leave the server and goes through the external ports of aws.

* Server.js file *
var socket = require ("socket.io")
var express = require ("express")
var https = require ("https")
var http = require ("http")
var logger = require ("winston")

var app = express ()

Function emitNewOrder () {
var http_server = http.createServer (app) .listen (3000, () => {
console.log ("Father and Love")
})
var io = socket.listen (http_server)
console.log ("go go s")
io.on ("connection", (socket) => {
console.log ("his dale")
socket.on ("new_order", (money) => {
console.log (money)
io.emit ("new_order", money)

    })
})

}

emitNewOrder ()

* Receiver.js file *

async function role () {
var socket = wait for io.connect (& # 39; http: //127.0.0.1: 3000 & # 39;);
socket.on ("new_order", function (data) {
console.log (date)
})
console.log (socket.connected)
}

        role()