0

As my app is currently under development, my local computer is temporarily acting as the server. Using the service by no-ip.com, I have managed to establish internet connection to the NodeJS server at my home, which has been supported by socket.io. However, although the HTTP connection is fine, every now and then the socket.io connection would fail until I restart the server. I have been investigating the cause of this. I wonder whether when the dynamic IP of the server changes, the socket.io which is listening to the ports fails. Could someone confirm this with me?

Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100

1 Answers1

1

Its definitely not the answer of your question but i think you're gonna like it ! use NGROK download & install it once it's done

launch your dev server

open cmd and type

c:\>ngrok http 3000 

3000 is your dev server PORT so if its something else change it

This will give you an address like that https://xxx232xx.ngrok.io

use this address to access your app now from any connected device

One last thing , when you use socket.io with https domains change your config and add the address

Example

   var ioSocket = io('https://xxx232xx.ngrok.io', {

      'reconnection delay': 2500,
      'secure':true,
      'max reconnection attempts': 10,
      'reconnection':true       

       });

Hope it helps !

Revln9
  • 837
  • 5
  • 10