Description
When attempting to build to device, the app will throw the below error when the app loads.
[ERROR] : Application Error: {
[ERROR] : "line": 2,
[ERROR] : "column": 10,
[ERROR] : "message": "Error while require(/app) [LiveView] File Server unavailable. Host Unreachable @ 192.168.2.2:8324\n[LiveView] Please ensure your device and computer are on the same network and the port is not blocked.",
[ERROR] : "native_stack": [
[ERROR] : "JSExportClass<class Titanium::GlobalObject>::CallNamedFunction"
[ERROR] : ]
[ERROR] : }
However
* The device and pc are on the same network
* I am able to access the LiveView server by going to
http://192.168.2.2:8324 in edge on the device
* I am able to access the apps app.js by going to
http://192.168.2.2:8324/app.js in edge on the device
Steps to reproduce
Ensure you disable the vEthernet switch as noted in TIMOB-23664
Enable LiveView in Studio
Build a project to Windows Phone Device
Try accessing the ip listed in the LiveView error from edge, and also accessing /app.js
Actual result
The device will not be able to connect to the LiveView server, but the LiveView server can be accessed using edge
Expected result
The device should be able to connect to the LiveView server
I believe I may know the root cause for this. In this loop LiveView will determine whether the connection is successful using this code here https://github.com/appcelerator/liveview/blob/master/build/liveview.js#L560-L567 Taking this code out and extracting it into the attached app.js shows that the readystate of the HTTPClient is never set to 4 by the SDK, as it is done on iOS and Android.
Steps to reproduce
Copy the code in the attached app.js and paste into your project, change the ip to your own, keep the port the same
Download the attached server.js and start it with
node server.js
Build for device or emulator and then click the button
Also see app2.js which uses the onload function rather than the way LiveView handles it, on Windows when onload is called request.readystate = 2, however on Android request.readystate=4master: https://github.com/appcelerator/titanium_mobile_windows/pull/791
PR pull/791 looks good, but it does not make LiveView work on Windows.
Merged TIMOB-23664.
Verified using: Windows 10 Pro Ti SDK: 6.1.0.v20170516173434 Appc CLI: 6.2.2-master.13 Appc NPM: 4.2.9 Windows 10 Mobile emulator Lumia 550 (10.0) LiveView 1.1.4 Studio: 4.9.0.201705170851 Devices and emulators are now able to connect to the LiveView server and changes are seen when the app is reloaded Closing ticket