I am working with ESP8266 moduls in Wifi-Station Mode. Each new ESP8266 module is assigned a different IP address by the wifi router. That’s why I need the Ip addresses as Javascript variable, but that doesn’t work:
let ip = location.host;
let str1 = 'http://';
let str3 = '/see';
let strIpAdress = str1+ip+str3; // doesn't work
//let strIpAdress = 'http://192.168.178.47/sse'; // works!
var source = new EventSource(strIpAdress);
console.log(strIpAdress); // http://192.168.178.47/sse
I have also tried in JavaScript String Object Format, but also without success.
Does a fixed IP address always have to be specified to prevent manipulation?
Is there a solution?