Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • explain how a pico is a first-class Internet citizen
  • explain channels and use the "My Picos" page to manage them
  • send events and queries to a pico using a browser, the event console, and the "Testing" tab
  • use logs
  • use the klog() operator

Motivation

When thinking about the idea of a pico, you have to understand that a pico is essentially a digital representation of "something". That "something" could be physical (like a temperature sensor) or conceptual (like a collection of sensors). The KRL rulesets installed on a given pico perform the magic that makes this digital representation behave the way you expect. And yet, how does a pico stay in sync with its physical device? How does it keep track of the new sensor you just added to the collection? How does it provide data to outside sources like web apps, or even a terminal using curl?

Here enters Events and Queries. Queries are very simple because the only thing they can do is call a function. This function is defined in the global block of a KRL ruleset installed on your pico. As a result, a query is not capable of changing state or taking action (like sending a text message). On the other hand, events can modify state and perform side effects. Incoming events are handled by the rules defined in a KRL ruleset.

This lesson aims to teach you how to send Events and Queries to a given pico.

Prerequisites

  • complete the Pico Engine Quickstart
  • have the hello_world ruleset from the Quickstart registered in the pico engine, and installed in a pico
  • have installed Postman, or some other HTTP app.

...