CSS and JS in production of Nodejs + Expressjs + Socket.IO

Asked

Viewed 284 times

-1

I have a problem in a chat using Nodejs + Expressjs + Socket.IO. In local environment no problems happen. However, when I put it into production I am having problems with CSS’s and JS’s. I open the page in Chrome, check the Network tab of Inspect and see that some files are marked as pending. It doesn’t happen often, but it’s happening on a good frequency. In other words, things are taking too long to load. What could that be? Sometimes it goes fast sometimes not.

I am using a dedicated server that can be seen here: https://www.hostgator.com.br/servidores/planos-de-servidor-dedicado.php What I have here is the dedicated standard.

I have tried to do basic things in Nodejs and go up for test and remains the same thing.

The test page is: http://grupicrm.com.br:3000/

  • At the beginning of index.js has var endereco = "http://192.168.1.100:3000/";, but the IP of grupicrm.com.br is 198.1.103.47 - will have to do?

  • I’m sorry, I’m making the substitution.

  • It seems that was the problem. I will put as answer.

  • It was not no. It was configured properly before and continued giving error.

1 answer

1

The request is being made to the wrong address.

At the beginning of index.js has

var endereco = "http://192.168.1.100:3000/";

But the IP of grupicrm.com.br is 198.1.103.47 - change to:

var endereco = "http://198.1.103.47:3000/";

Another thing: it seems that Hostgator does not allow sockets, unless you have a dedicated server and make a request opening a ticket:

https://support.hostgator.com/articles/pre-sales-policies/socket-connections

Look in the table, in English (search for Socket Server):

http://faq.hostgator.com.br/content/1/99/pt-br/compatibilidade-disponibilidade-de-alguns-servi%C3%A7os-e-tecnologias.html

  • @j-Bruni this was an error of the last commit I made I forgot to change. However, this file pending problem is old. I even fear that it may be a problem with the server and not with the application.

  • Ok. I updated the answer - take a look. It looks like it’s the Hostgator blocking even...

  • It may be a possibility yes. I will be contacting Hostgator and give a positioning here. However, I can visualize your connections in the panel. And there is information being exchanged. Which implies that the sockets are open, not?

  • In the panel here, only the initial request returns (to http://grupicrm.com.br:3000/socket.io/1/?t=1395321623072, ie still using HTTP). Then, to effectively use the socket, it only gives "pending"...

  • I saw what you said. But I believe that it is there pending even because the sockets are open and there is exchange of information. I’m still waiting for an answer from Hostgator regarding this. But sometimes this pending appears even before you get to the socket.io.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.