Sky Event Console


A debugging console makes working with the new Sky event API and debugging KRL rulesets easier. This post shows you how.


When you're writing a KRL ruleset, you can turn debugging logs on quite easily using the logging pragma in the meta section of the ruleset:

meta {
  logging on

The debugging statements are returned at the top of the payload that results from the execution as JavaScript comments. When you're running KRL from within a browser this works great since you can just look at the payload and see the result. As I've moved more and more to the new Sky API, this is more of a problem. Of course, since the API is HTTP-based, you can always call the Sky API event signal URL (ESL) from the browser, but that can cause token contamination since sometimes the Kynetx token from KBX and the token in the ESL clash. Besides, who wants to edit raw URLs?

As a consequence, I built a console for running Sky ESL's. The console is based on Code in Chaos' excellent Rest Console, a app for Google Chrome. The Sky Event Console is simpler than a full-blown Rest console and tuned to the kinds of things I like to do while debugging a KRL ruleset. Here's what it looks like:

Sky Event Console

You can enter the event domain and type, a token, 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.

There are a few things I've got planned to improve the console:

  • Now that there's a place where debug information goes, it's possible to add more structure and then use the tool to parse and display it.
  • The Authorization section is hidden for now (you can open it by clicking on it). In the near term, we'll be adding OAuth support to the Sky API and then authorization will make the console the best way to interface with Sky.

If you're a KRL programmer and you'd like to start using the console, you can grab it on Github. You'll need to load it as an unpacked extension. Load the /applications folder from the Github source, not the /extensions folder since this is a Chrome app, not an extension.

You'll also need to know how to create tokens for your account. Sky is still early beta, so we haven't made tokens visible on every account, but they're there. Log into and then click on your email address in the upper right-hand corner. The URL you see is your account profile URL. Just add /tokens to it and you'll see a place to create and manage tokens. Create all you want. Each token represents a private event address for your personal event network. Once you've created a token, just plug it into the Sky console.

Now, install a ruleset in your Kynetx account and start raising rules to your personal event network. Randy Bohn has a short tutorial that includes a ruleset you can use if you like.