Basic HTTP Stream

HTTP Stream with REST and Websocket

API Features Demonstrated

Platforms

This app works on:

Requirements and Prerequisites

This app requires a ZentriOS evaluation board with two user LEDs and two user buttons.

Resources

The file settings.ini is used to initialize the device. It is packaged with the app.

A root html file, http_stream.html, is served by the ZentriOS HTTP Server. It is downloaded to device flash.

Description

This app demonstrates using either HTTP REST or a Websocket to send control data to, and receive monitor information from, a ZentriOS module.

Usage Instructions

Open a ZentriOS serial terminal to the device. See Getting Started, Opening a ZentriOS Terminal.

This app assumes your ZentriOS device is set up with the credentials to join your local network. If you have not already set up network credentials, on the ZentriOS terminal, run the commands:

network_up -s
save

See the Wi-Fi Command API documentation for network_up and save.

After building, downloading and running the app, wait until the device connects to the network.

Connect a PC or mobile device to the same network as the ZentriOS device and open a browser to the URL mDNS name http://http_stream.local. The device name is configured in the settings.ini file with mdns.name.

The browser displays an interactive page for monitoring and controlling the device buttons and LEDs using either a REST interface or a WebSocket interface.

Click the LED buttons to switch the device LEDS on and off. Press and release the device buttons to see the web page Button indicators change.

Source

See:

See also: