sarahhendricks / Loominary

The code behind the loom-based video game!
http://loominary.info
MIT License
3 stars 1 forks source link

Bug - Internet connection required to start up story, but not continue it #2

Open sarahhendricks opened 7 years ago

sarahhendricks commented 7 years ago

Currently cannot start up a story w/out having WiFi/Ethernet connection, should not be happening because the browser directs to localhost.

How to test? Windows IoT requires WiFi/Ethernet connection to debug

sarahhendricks commented 7 years ago

I believe the issue is in Windows IoT Browser in the App.xaml.cs file. We are creating a new Frame for the content, and since it is null, we call rootFrame.Navigate(typeof(MainPage), e.Arguments);. I think the Navigate() function is requiring an internet connection within the code. Will continue to investigate.

sarahhendricks commented 7 years ago

Drilled into the Frame class and the Navigate() function - came to a dead end. Can't see what the function is actually doing - will discuss with @dr-jam

sarahhendricks commented 7 years ago

Found the Frame class online: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.frame#Windows_UI_Xaml_Controls_Frame_Navigate_Windows_UI_Xaml_Interop_TypeName_System_Object_

Navigate() says specifically that it "Causes the Frame to load content represented by the specified Page." Not sure if this is requiring the internet or not.

sarahhendricks commented 7 years ago

Went looking at NodeJS instead, found this interesting article: http://stackoverflow.com/questions/31326178/does-node-js-server-need-internet-connection-to-run

Maybe switch localhost to 127.0.0.1 and see if that changes things?

sarahhendricks commented 7 years ago

Opened up a question on the Windows IoT development page here: https://social.msdn.microsoft.com/Forums/en-US/38d201c0-310a-489b-9f00-83f58788fd0d/debugging-windows-iot-browser-application?forum=WindowsIoT

sarahhendricks commented 7 years ago

My hunch is that we have a race condition; for whatever reason, the Browser sets up first and sends its one GET request to the NodeJS server, which isn't ready to handle requests yet.

A thought: maybe browser sends GET requests to server until gets a hit, then stops?

sarahhendricks commented 7 years ago

As another thought, the USB for the Cottonwood board has lights on its input-output wires. These only seem to come on when the NodeJS server has come up & established the sockets. These lights do not come on when the Ethernet is removed at startup. So a problem with NodeJS starting up without Internet?

sarahhendricks commented 7 years ago

Updated the code to have the browser ping the server multiple times until it gets a hit. This now covers the use case where the browser finishes setup before the server is ready.

Still have the Internet error.

sarahhendricks commented 7 years ago

Update: when the pi starts up with no internet, you get the white screen. Pluging in the internet and quickly opening the app manager shows that the NodeJS app is not running, but starts up when gets an internet connection. After you plug in the internet, the server starts up and serves the webpage. It doesn't connect to the RFID program though.

sarahhendricks commented 7 years ago

The RFID program is what causes the lights to start running. Why is it not working without internet???

sarahhendricks commented 7 years ago

Fixed the RFID program - It was searching for the Pi's IP address to add to its tags, even though its not necessary to work.

The NodeJS still won't work at startup without internet, though. Once it's connected to the internet, everything starts up and is fine. My new hunch is the sockets.

sarahhendricks commented 7 years ago

Update: there is a workaround that we have used: connect the Pi via Ethernet to a computer, just for startup. Still need an actual fix.