What you want is ignoring host name in an http request, in other words, catch any host names (and even ip addresse) to control in- and out-flow... and that happens on the networking level.
Any http request with a host name goes first through a name resolution requst-response phase which returns an ip address to the requestor. The name resolution request is made towards naming server address and includes only the hostname as payload. Upon return of valid ip address as successful result of hostname resolution, the requestor (your phone) makes the actual request with the application payloads. If you lookup the host name's ip address upfront and use it in the request, then no hostname resolution is required and the request with payload is made right away to the given ip address.
Intercepting any request and control its 'routing' is what you are loking for. I'm pretty sure that is natively implemented in the network software stack that comes with ESP8266 SDK libraries and is just bound into the Espruino build.
The Espruino build exposes some value setting and getting and some functions as methotrexate of the Wifi object, but I have seen nothing that would allow to plug or chain in (your own) routing and session modification functions. May be the Lua implementation you have seen may give you some hints where to apply the crowbar to make it happen.
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.
What you want is ignoring host name in an http request, in other words, catch any host names (and even ip addresse) to control in- and out-flow... and that happens on the networking level.
Any http request with a host name goes first through a name resolution requst-response phase which returns an ip address to the requestor. The name resolution request is made towards naming server address and includes only the hostname as payload. Upon return of valid ip address as successful result of hostname resolution, the requestor (your phone) makes the actual request with the application payloads. If you lookup the host name's ip address upfront and use it in the request, then no hostname resolution is required and the request with payload is made right away to the given ip address.
Intercepting any request and control its 'routing' is what you are loking for. I'm pretty sure that is natively implemented in the network software stack that comes with ESP8266 SDK libraries and is just bound into the Espruino build.
The Espruino build exposes some value setting and getting and some functions as methotrexate of the Wifi object, but I have seen nothing that would allow to plug or chain in (your own) routing and session modification functions. May be the Lua implementation you have seen may give you some hints where to apply the crowbar to make it happen.