Raising Events

A pico is an event processing system. The functionality of a pico is independent of how the events are transported. Currently, events are transported over HTTP, encoded using the Sky Event protocol

We welcome suggestions (and especially help) in creating support for other transport protocols like MQTT, XMPP, etc. Just fork the pico engine repo, add one, and send us a pull request.

Getting an ECI

Sky events are raised on an event channel that is tied to a specific pico. Event channels can be managed from the Channels tab in the pico engine UI. 

Raising Events from the Testing tab

As the developer of a ruleset, you can instrument your code with testing specifications. If you have done this, then you can raise an event by filling in and submitting a form on the Testing tab. For complete details see the Pico Engine UI – Testing tab page.

Raising Events with Postman

Postman also offers an excellent way to raise events to a pico. You can download the app onto your computer here. It looks something like this:



The left column provides different folders that you can create to represent different projects. The bar in the top middle of the screen is the location where you build your sky event or sky cloud request, using the pico's eci that you would like to send the query/event to. Near the top right of the screenshot, there is a save option which will allow you to rename and save the current settings for this single HTTP request into any folder you would like (here, the current HTTP request selected is called "New Message"). By clicking on the "Params" button, a dropdown will list the key/value pairs that you can enter. These parameters will be saved and automatically appended to your HTTP request, so once you build your request via the API's, don't worry about manually entering anything. Any directives or results will be neatly shown down below in the empty box declaring, "Hit the Send button to get a response."

Remember:

  • Use the Sky Event and Sky Cloud API's to build the URL

  • The Sky Event API is used to raise events

  • The Sky Cloud API is used for retrieving information that is shared in your ruleset

Raising Events with curl

Because events are simply represented by a specially formatted URL called a "event signal URL" (ESL), you can use curl or even a browser to raise events. For example, the following raises the event foo:bar on the ECI ABCD-1234 with EID 56789 on an engine host at example.com (if you don't know what these mean, read the Sky Event protocol page):

curl http://example.com/sky/event/ABCD-1234/56789 --data "_domain=foo&_type=bar"

Raising Events with the Sky Event Console

The Chome app has not been updated to work with modern version of Chrome. The Testing Tab is a acceptable substitute.

The Sky Event Console is a Chrome application that raises events directly to the Sky API

Download the source code for the Sky Event Console from github.com. You install it as an unpacked extension from the source from the Extensions page in Chrome. 

Once you do, the console looks like this:

You can enter the event domain and type, an ECI, and any event attributes.

  • Clicking on the “Raise Event” button at the bottom raises the event to the specified event engine for the user identified by the token.

  • Any rule sets that are salient for the given event are executed and the results are returned and show at the bottom.

  • Clicking the “Debug” button shows the debug results.

  • The console saves your last inputs from invocation to invocation. You can also easily see the raw response, response headers, request body, and request headers.


The Sky Event Console assumes that the event should be raised using SSL and thus prepends https: by default when forming the ESL. The Node pico engine does not support SSL in the Sky API by itself, so uncheck any "Use HTTPS" box unless you use something like NGINX.

Raising Events with HTTP with Libraries

  • Phil Windley has written a perl library, Kinetic::Raise, that supports properly formatting events for picos from within Perl programs.

  • The Wrangler library has facilities for formatting and raising events from JavaScript. 

  • Braden Hitchcok has written a python module, picosapi, for formatting and raising events from Python

If you develop libraries for other programming languages or frameworks, please let us know by posting to the Forum



Copyright Picolabs | Licensed under Creative Commons.