How the website works. (The Technical Features story as written by Marco)
In order to make Steve run all the technical features on the website without him touching anything is
quite a task and often not understood. One of the most common questions in the YouTube chat asks:
"Unknown Road ?? hows that possible this is....."
To give you a detailed look at how things work I'm gonna take you through the whole process.
We start off with a simple app on his phone which runs on the same phone the Snowman webcam sends
his pictures to the webserver every 10 seconds or so.
At the same time, the GPS software sends its data to the database server and is being stored for use on the website.
Then the scripting does the work and produces the information on the website and the Youtube chat.
The first thing we do before we even get going is setting up a trip. In this sequence, Steve puts in the location for departure, pick up, possible route points
(fuel-stops or points to make the route look like he's gonna drive it ) and the one or more delivery locations.
In this process, the data get saved and processed into Coordinates, and the distances get calculated. Once this is done, all is saved in the database and ready for the website to show - where we go, how long its gonna take and what not.
Then before we start driving, Steve turns on the GPS app and it starts sending its data to the server. The app sends way more data then we could possibly use on the website, due to the limitations on the webserver
and to be able to let the visitors have a fluidly experience, but to make sure we get the most up-to-date data,
its better to have too much rather then being late.
The Speed, Altitude, and Direction data do not need processing (other then mph to km/h) and thus are the latest info
available when you open the website. When keeping the page open, it refreshes parts of the dashboard itself every 60 secs
(again to not stress the webserver) for the Speedometer and Compass. The other parts refresh every 5 minutes. The location data comes in as Coordinates, and need to be processed to things such as distances between locations,
and being translated into readable names of where we are just like the names of the location on the snowman camera,
sometimes it doesn't know it either (remember)?
The location data gets processed by an internal command structure called CRON-jobs. These jobs run every 5 minutes
(again to not stress the webserver even more). During this process, we determine the distance from the truck
opposed to the destination which will result in the miles to drive and percentage done for the tracker. Also in this process we do the weather information pull based on the current truck location. Then we also run the conversion for the coordinates to names and all other useful information the GPS database
is able to provide us. This includes the roadname we're on and the timezone we're in.
Due to the fact this runs only once every 5 minutes it is possible to have a wrong roadname/number when Steve turns
to a new road and the 5 minute click just been processed. It then takes 5 more minutes to show the correct data.
The road sign-script is designed to show Interstates "I-" and highways "US-" and state routes for example "CA-". Once we are on a road that does not have either of these criteria, it will be a named-road and it will be showing "unkown" or "local"
road to make sure either Steve or the customer gets their privacy taken care of when stopped.
Since the dashboard has the truck time based on where Steve is and the webserver has its own, which always differ
from each other, unless he drives in the timezone where the server is located the only thing that is the same are the minutes. To know whether the CRON-job has run and you can access the most uptodate info, always check the truck time and see whether
its past 05, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, or 00 minutes.
The PA (Private Area) setting makes sure the snowman closes his eyes when the difference between the destination and current
truck location is met, again, this is based on the CRON-jobs that run every 5 minutesT. herefore we sometimes get to see more then intended, as the distance is not met on the 5 minute click from the cronjob while
we are really close to it already.
So how does the nightbot know all this then?? Basically we tell the nightbot to pull the information from the website and display it in the chatroom.
This is why it sometimes shows the information a little slower then usual.
It then means that the webserver is quite busy doing other stuff, serving pages to visitors or running the cronjobs in the background.
The trip map is built based on the coordinates from the locations Steve put in the trip maker and then when we
add the position from the truck in the 5 minute cronjob update.
This will show us the route and the current truck location in one view.
Maps are based on Open Street Map and have a limitation in zoom for privacy rules.
The Markers on the map are color based on the setting in the tripmaker, being it a departure or delivery or pick up or route point.
Can we do realtime?? We would like Realtime infomation to the website, but we are somewhat limited to what the phone-network
and the webserver can handle. This is about the very best we can provide.
And, the best part of it, it's all done without any interference from Steve, it is all automatically processed without the need
for him to attend to it, this way he can fully give his attention to the road and drive safely!!
I hope this will give ya'll a better understanding of how the website works for the technical features Steve offers.