0

I've node.js as a server and listen on port 3000. Node.js will render vue.js that has already built when the server start. I've declare var socket = io('http://127.0.0.1:3000'); inside the vue.js and then expose my localhost via ngrok. And it seems to work well inside the same localhost (intranet) until I try to connect from outside localhost. There's no connection between vue and the server. I've debugged and figured out that when I connect from outside the intranet it's trying to connect back to its localhost (127.0.0.1) instead of connecting back to its generated live tunnel like 6928b3e5.ngrok.io. I use a free version of ngrok and it gonna generate a new tunnel every time the server start so how do I make a connection back to its live tunnel?

UHU
  • 55
  • 1
  • 7

1 Answers1

0

I actually solve this now by using var socket = io(); inside the client

UHU
  • 55
  • 1
  • 7