I'm not 100% sure but I think it's possible that you may be getting two WiFi 'connected' events from the two different WiFi connections. In that case what'd be happening is the EspruinoWiFi would be not only trying to create an HTTP server on the same port twice, but the first time it'd be doing it at the same time as connecting to a WiFi access point.
Do you think you could try this instead of your existing onInit and see if it helps? I added a few extra delays - they may not all be required but I guess it's possible they would help.
The main thing though was removing the 'connected' handler and just calling it manually after the second connection was made.
While it might make some sense to do stuff on the 'connected' handler (for instance if WiFi dropped out and then reconnected) you'd need to make sure you handle it properly. Right now you'd end up creating a new interval with dataInterval each time you reconnected without properly removing the old one first.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm not 100% sure but I think it's possible that you may be getting two WiFi 'connected' events from the two different WiFi connections. In that case what'd be happening is the EspruinoWiFi would be not only trying to create an HTTP server on the same port twice, but the first time it'd be doing it at the same time as connecting to a WiFi access point.
Do you think you could try this instead of your existing onInit and see if it helps? I added a few extra delays - they may not all be required but I guess it's possible they would help.
The main thing though was removing the 'connected' handler and just calling it manually after the second connection was made.
While it might make some sense to do stuff on the 'connected' handler (for instance if WiFi dropped out and then reconnected) you'd need to make sure you handle it properly. Right now you'd end up creating a new interval with dataInterval each time you reconnected without properly removing the old one first.
Hope that's some help!