Versions Compared

Key

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

Often we feel a need to call a function which is shared by a ruleset installed in a different pico. There are two ways to do this.

...

Wrangler's skyQuery function will send an HTTP GET request to the other pico, which includes the RID and function name, and the named argument values which the remote function expects. It will check the HTTP return code, and decode the returned content, finally returning it to our code as KRL data. If an error is detected, the return value will instead be a Map with keys errorhttpStatusskyQueryErrorskyQueryErrorMsg, and skyQueryReturnValue. On the other hand if the response to the underlying HTTP request does not indicate an error, the return value is the KRL data computed by the remote function.

Use http:get() directly

Since each pico is a first-class Internet citizen, it has an API, so we can use techniques that are applicable to any external API, as discussed in the Modules and External APIs Lesson. The same example might be written this way:

...