Version: 1.0
Status: ⚫⚪⚪
Spark plugin for Thunder framework.
This document describes purpose and functionality of the Spark plugin. It includes detailed specification about its configuration, methods and properties as well as sent notifications.
All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
The Spark plugin provides web browsing functionality based on the Spark engine.
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
The table below lists configuration options of the plugin.
Name | Type | Description |
---|---|---|
callsign | string | Plugin instance name (default: Spark) |
classname | string | Class name: Spark |
locator | string | Library name: libThunderSpark.so |
startmode | string | Determines if the plugin shall be started automatically along with the framework |
configuration | object | (optional) |
configuration?.url | string | (optional) The URL that is loaded upon starting the browser |
This plugin implements the following interfaces:
- Spark.json (version 1.0.0) (uncompliant-extended format)
- Browser.json (version 1.0.0) (uncompliant-extended format)
- StateControl.json (version 1.0.0) (uncompliant-extended format)
The following methods are provided by the Spark plugin:
Browser interface methods:
Method | Description |
---|---|
delete | Removes contents of a directory from the persistent storage |
delete method
Removes contents of a directory from the persistent storage.
Use this method to recursively delete contents of a directory
Name | Type | Description |
---|---|---|
params | object | |
params.path | string | Path to directory (within the persistent storage) to delete contents of |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
The given path was incorrect |
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.delete",
"params": {
"path": ".cache/wpe/disk-cache"
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
The following properties are provided by the Spark plugin:
Browser interface properties:
Property | Description |
---|---|
url | URL loaded in the browser |
visibility | Current browser visibility |
fps RO | Current number of frames per second the browser is rendering |
StateControl interface properties:
Property | Description |
---|---|
state | Running state of the service |
url property
Provides access to the URL loaded in the browser.
Also see: urlchange
Name | Type | Description |
---|---|---|
(property) | string | URL loaded in the browser |
Name | Type | Description |
---|---|---|
result | string |
Code | Message | Description |
---|---|---|
15 | ERROR_INCORRECT_URL |
Incorrect URL given |
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.url"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "https://www.google.com"
}
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.url",
"params": "https://www.google.com"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
visibility property
Provides access to the current browser visibility.
Also see: visibilitychange
Name | Type | Description |
---|---|---|
(property) | string | Current browser visibility (must be one of the following: visible, hidden) |
Name | Type | Description |
---|---|---|
result | string | (must be one of the following: visible, hidden) |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Returned when the operation is unavailable |
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.visibility"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "visible"
}
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.visibility",
"params": "visible"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
fps property
Provides access to the current number of frames per second the browser is rendering.
This property is read-only.
Name | Type | Description |
---|---|---|
result | number | Current number of frames per second the browser is rendering |
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.fps"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": 30
}
state property
Provides access to the running state of the service.
Also see: statechange
Name | Type | Description |
---|---|---|
(property) | string | Running state of the service (must be one of the following: resumed, suspended) |
Name | Type | Description |
---|---|---|
result | string | (must be one of the following: resumed, suspended) |
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.state"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "resumed"
}
{
"jsonrpc": "2.0",
"id": 42,
"method": "Spark.1.state",
"params": "resumed"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.
The following events are provided by the Spark plugin:
Browser interface events:
Event | Description |
---|---|
urlchange | Signals a URL change in the browser |
visibilitychange | Signals a visibility change of the browser |
StateControl interface events:
Event | Description |
---|---|
statechange | Signals a state change of the service |
urlchange event
Signals a URL change in the browser.
Name | Type | Description |
---|---|---|
params | object | |
params.url | string | The URL that has been loaded or requested |
params.loaded | boolean | Determines if the URL has just been loaded (true) or if URL change has been requested (false) |
{
"jsonrpc": "2.0",
"method": "client.events.1.urlchange",
"params": {
"url": "https://www.google.com",
"loaded": false
}
}
visibilitychange event
Signals a visibility change of the browser.
Name | Type | Description |
---|---|---|
params | object | |
params.hidden | boolean | Determines if the browser has been hidden (true) or made visible (false) |
{
"jsonrpc": "2.0",
"method": "client.events.1.visibilitychange",
"params": {
"hidden": false
}
}
statechange event
Signals a state change of the service.
Name | Type | Description |
---|---|---|
params | object | |
params.suspended | boolean | Determines if the service has entered suspended state (true) or resumed state (false) |
{
"jsonrpc": "2.0",
"method": "client.events.1.statechange",
"params": {
"suspended": false
}
}