-
Notifications
You must be signed in to change notification settings - Fork 0
architecture.md
A configured device connects to the dashboard over the secure Websocket,
sending a Authorization: Bearer GENERATED_TOKEN
handshake header.
After the successful handshake, all communication is done via the
JSON-RPC 2.0 protocol. Each RPC frame wrapped into the Websocket frame.
The RESTful API endpoints that the dashboard exports start with
/api/v2/
. The endpoints that for the individual device start with
/api/v2/devices/:id
, where :id
is the unique device ID, generated at
the device registration together with the access token.
The dashboard gives a RESTful access to all RPC services exported by the device.
Thus, the dashboard acts as a JSON-RPC / RESTful bridge. The device's
RPC methods are mapped to /api/v2/devices/:id/rpc/:method
endpoints.
If the RPC endpoint does not accept any parameters, you cat use GET
HTTP
method. If it does, POST
must be used. The parameters should be a JSON
string, and the Content-Type: application/json
header must be set, e.g.:
curl \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_KEY' \
-d '{"pin": 2}' \
http://dash.mongoose-os.com/api/v2/devices/DEVICE_ID/rpc/GPIO.Toggle
When a device comes online, the dash
library that is responsible for the
dashboard connection, sends a shadow update message with the information
about the device: architecture, firmware version, etc:
![](# Technical overview
A configured device connects to the dashboard over the secure Websocket,
sending a Authorization: Bearer GENERATED_TOKEN
handshake header.
After the successful handshake, all communication is done via the
JSON-RPC 2.0 protocol. Each RPC frame wrapped into the Websocket frame.
The RESTful API endpoints that the dashboard exports start with
/api/v2/
. The endpoints that for the individual device start with
/api/v2/devices/:id
, where :id
is the unique device ID, generated at
the device registration together with the access token.
The dashboard gives a RESTful access to all RPC services exported by the device.
Thus, the dashboard acts as a JSON-RPC / RESTful bridge. The device's
RPC methods are mapped to /api/v2/devices/:id/rpc/:method
endpoints.
If the RPC endpoint does not accept any parameters, you cat use GET
HTTP
method. If it does, POST
must be used. The parameters should be a JSON
string, and the Content-Type: application/json
header must be set, e.g.:
curl \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_KEY' \
-d '{"pin": 2}' \
http://dash.mongoose-os.com/api/v2/devices/DEVICE_ID/rpc/GPIO.Toggle
When a device comes online, the dash
library that is responsible for the
dashboard connection, sends a shadow update message with the information
about the device: architecture, firmware version, etc:
ADS1X1X I2C ADS7843/XPT2046 SPI APDS9960 I2C ATCA BH1730 sensor BME280/BMP280 BQ27421 Barometers Bosch BM222 CCS811 I2C DHT DS3231 I2C Dallas RMT ESP32 touch sensor HTU21D(F) I2C ILI9341 SPI IMU INA219 I2C INA226 I2C INA3221 I2C Inventek ISM43xxx WiFi MAX7219 I2C MAX72xx LED matrix MCP23XXX I2C MCP9808 I2C MQ135 gas sensor Neopixel Onewire RMT PCF857X I2C SHT31 I2C SSD1306 OLED STMPE610 SPI Si7005 sensor Si7021 I2C TI TMP006 temp sensor VEML6075 I2C VFS (LittleFS) VFS (RAM) VFS (SPI NOR Flash) VFS (SPIFFS) VFS (Winbond W25XXX) VFS (another device) VFS (encryption) VFS bh1750 I2C
RPC core RPC loopback RPC over BLE GATT RPC over MQTT RPC over UART RPC over UDP Service - ATCA Service - Config Service - Cron Service - FS Service - GATT client Service - GPIO Service - I2C Service - OTA Service - WiFi