SMQ Weather Application
The SMQ Weather Application illustrates how a web-based user interface can be synchronized with the user interface in a device. The SMQ Weather Application consists of three parts: the server application, the thermostat (device), and the browser user interface.
The following video shows how to download, run, and how to synchronize the device user interface and two browser user interfaces.
- Download the simulated device weather application for Windows.
- Run the self extracting archive and unpack the application to any directory.
- The simulated device weather application should automatically start.
- Click the menu button (three stripes) to open the dialog box.
- Click start browser or manually enter the device key in the web user interface.
- The simulated device is unable to connect to the online server when a proxy is used in the corporate network.
- The online server fetches weather data from OpenWeatherMap, a process that sometimes takes considerable time. The OpenWeatherMap servers are slow to respond.
The SMQ Weather Application illustrates the following:
- Real time synchronization between native device UI and browser UI
- How to use a custom server side app for device to browser synchronization
- How to use a custom server side app for connecting to third party services
- How a custom server side app can function in a cluster
- How Round Robin DNS can help you cut IoT services cost; see the article Cheaper Alternatives to IoT Cloud Services for details.
The weather data is synchronized in real time between the device and the client. The server application is in charge of maintaining a connection island between the device and any number of connected clients. The client is synchronized with the device by entering the device ID in the browser. You can automate this process by letting the simulated device open a browser window for you. The device ID will be automatically filled in when the browser window starts. Optionally: you may manually enter the device key in the browser interface by clicking the menu button and then Connect.
Suggested test exercise:
- Connect a second browser window by either entering the device key in the browser or by clicking the menu button in the device and then the Start Browser button. You may open a third browser window and many more.
- Click the plus or minus button in the thermostat in any of the browser windows or in the device. Notice how all synchronized user interfaces are updated simultaneously.
- In a connected browser user interface, click the menu button and set the city to another city. Notice how all connected user interfaces are updated with the new city, including the device
You cannot start a second simulated device on the same PC. The device requires a unique ID (the device ID), a number that is fetched from Windows. You may, however, start a simulated device on another PC. The server code maintains a connection island for each connected device -- that is, any number of devices can connect to the online server and any number of browsers can connect to each device.