Cobalt Plugin
Version: 1.0
Status:
Cobalt plugin for Thunder framework.
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Cobalt plugin. It includes detailed specification about its configuration, methods and properties as well as sent notifications.
Case Sensitivity
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.
Acronyms, Abbreviations and Terms
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. |
References
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Description
The Cobalt plugin provides web browsing functionality based on the Cobalt engine.
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
Configuration
The table below lists configuration options of the plugin.
Name | Type | M/O | Description |
---|---|---|---|
callsign | string | mandatory | Plugin instance name (default: Cobalt) |
classname | string | mandatory | Class name: Cobalt |
locator | string | mandatory | Library name: libThunderCobalt.so |
startmode | string | mandatory | Determines in which state the plugin should be moved to at startup of the framework |
configuration | object | optional | ... |
configuration?.url | string | optional | The URL that is loaded upon starting the browser |
configuration?.width | integer | optional | The width in pixels of the surface to be used by the application |
configuration?.height | integer | optional | The height in pixels of the surface to be used by the application |
configuration?.repeatstart | integer | optional | The number of milliseconds a key should be pressed to start reapeating (set max to adhere to Thunder) |
configuration?.repeatinterval | integer | optional | The number of milliseconds the repeated key is send after it started repeating (set max to adhere to Thunder) |
configuration?.clientidentifier | string | optional | An identifier, used during the surface creation as additional information |
configuration?.operatorname | string | optional | The name of the operator that owns the infrastructure on which this device is running |
configuration?.language | string | optional | The language to be used to for user interaction |
configuration?.connection | string | optional | The type of connection that is used for internet connectivity (must be one of the following: cable, wireless) |
configuration?.playbackrates | boolean | optional | If enabled, Cobalt supports different rates, otherwise, it supports only 0 and 1 (default: true) |
Interfaces
This plugin implements the following interfaces:
- Cobalt.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)
Methods
The following methods are provided by the Cobalt 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.
Description
Use this method to recursively delete contents of a directory
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.path | string | mandatory | Path to directory (within the persistent storage) to delete contents of |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null (default: None) |
Errors
Message | Description |
---|---|
ERROR_UNKNOWN_KEY |
The given path was incorrect |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.delete",
"params": {
"path": ".cache/wpe/disk-cache"
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
Properties
The following properties are provided by the Cobalt plugin:
Browser interface properties:
Property | R/W | Description |
---|---|---|
url | read/write | URL loaded in the browser |
visibility | read/write | Current browser visibility |
fps | read-only | Current number of frames per second the browser is rendering |
StateControl interface properties:
Property | R/W | Description |
---|---|---|
state | read/write | Running state of the service |
url property
Provides access to the URL loaded in the browser.
Also see: urlchange
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | URL loaded in the browser |
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | URL loaded in the browser |
Errors
Message | Description |
---|---|
ERROR_INCORRECT_URL |
Incorrect URL given |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.url"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "https://www.google.com"
}
Set Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.url",
"params": "https://www.google.com"
}
Set Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
visibility property
Provides access to the current browser visibility.
Also see: visibilitychange
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Current browser visibility (must be one of the following: hidden, visible) |
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Current browser visibility (must be one of the following: hidden, visible) |
Errors
Message | Description |
---|---|
ERROR_UNAVAILABLE |
Returned when the operation is unavailable |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.visibility"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "hidden"
}
Set Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.visibility",
"params": "hidden"
}
Set Response
{
"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.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | integer | mandatory | Current number of frames per second the browser is rendering |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.fps"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 30
}
state property
Provides access to the running state of the service.
Also see: statechange
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Running state of the service (must be one of the following: resumed, suspended) |
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Running state of the service (must be one of the following: resumed, suspended) |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.state"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "suspended"
}
Set Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.state",
"params": "suspended"
}
Set Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
Notifications
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 Cobalt plugin:
Browser interface events:
Notification | Description |
---|---|
urlchange | Signals a URL change in the browser |
visibilitychange | Signals a visibility change of the browser |
StateControl interface events:
Notification | Description |
---|---|
statechange | Signals a state change of the service |
urlchange notification
Signals a URL change in the browser.
Notification Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.url | string | mandatory | The URL that has been loaded or requested |
params.loaded | boolean | mandatory | Determines if the URL has just been loaded (true) or if URL change has been requested (false) (default: True) |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.register",
"params": {
"event": "urlchange",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.urlchange",
"params": {
"url": "https://www.google.com",
"loaded": false
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.urlchange
.
visibilitychange notification
Signals a visibility change of the browser.
Notification Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.hidden | boolean | mandatory | Determines if the browser has been hidden (true) or made visible (false) |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.register",
"params": {
"event": "visibilitychange",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.visibilitychange",
"params": {
"hidden": false
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.visibilitychange
.
statechange notification
Signals a state change of the service.
Notification Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.suspended | boolean | mandatory | Determines if the service has entered suspended state (true) or resumed state (false) |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "Cobalt.1.register",
"params": {
"event": "statechange",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.statechange",
"params": {
"suspended": false
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.statechange
.