0% found this document useful (0 votes)
24 views10 pages

LEA-Open-API-Websockets-June-2020

The LEA Open API utilizes a Websocket protocol for controlling and monitoring LEA Connect Series products via JSON-RPC messages. It allows devices to communicate over websockets, with commands for setting, getting, subscribing, and unsubscribing to various parameters of the amplifiers. The document provides examples of websocket commands and responses, as well as details on object hierarchy and subscription mechanisms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views10 pages

LEA-Open-API-Websockets-June-2020

The LEA Open API utilizes a Websocket protocol for controlling and monitoring LEA Connect Series products via JSON-RPC messages. It allows devices to communicate over websockets, with commands for setting, getting, subscribing, and unsubscribing to various parameters of the amplifiers. The document provides examples of websocket commands and responses, as well as details on object hierarchy and subscription mechanisms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

LEA Open API -

Websocket Protocol
Rev 1. 06-01-2020

Introduction

Websockets are used as the transport for the LEA WebUI. Websockets are convenient since
they combine the reliability of TCP with the notion of message boundaries. The LEA Connect
Series products utilize JSON-RPC protocol and can be controlled and monitored from any device
that is capable of sending and receiving JSON-RPC messages. The LEA Connect Series products
offer an Open API via websockets, so any parameter that can be controlled and/or monitored
via the WebUI can be controlled and monitored by any other device that communicates via
websockets.

The LEA Connect Amplifiers use port 1234 for websocket communication

Any LEA Connect Firmware version accepts Websocket communication, however new
features will be added in the future and will be included in future firmware versions.

Patterned after JSON-RPC 2.0 (https://www.jsonrpc.org/specification)

• the 'jsonrpc' member is replaced with an 'leaApi' member


• an additional 'url' member is required in requests and non-error responses
• the 'id' member, when present in requests, must be an integer number in the range [0,
INT32_MAX]
• batch mode messages are not supported

LEA amplifiers typically act in the server role, while UIs and other devices act in the client role. It
is also possible for devices to interact peer-to-peer, either over a single web/tcp socket or a pair
of web/tcp sockets.

1|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

An example LEA Websocket API message looks like this. In this case, a request to set an amp's
channel 1’s mute status from mute off (False) to mute on (True)

Websocket Command Sent:

{
"leaApi": "1.0",
"url": "amp/channels/1/output",
"method": "set",
"params": {"mute":true},
"id": 1
}

Websocket Response confirming Mute Command successful

{
"leaApi": "1.0",
"url": "amp/channels/1/output",
"result": "OK",
"id": 1
}

Example Websocket Message Element

{ Opening bracket

"leaApi": "1.0", (Should always start with this)

(where the control and monitor command


"url": "amp/channels/1/output", you want to interact with resides)
(What do you want to do? Set, Get,
"method": "set", Subscribe, Unsubscribe, and Info)

"params": "mute":true}, (The parameter and what you want to do with it)

"id": 1 (Should always end with this)

} Closing bracket

2|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

Amp Object Hierarchy

Resources are divided into chunks called objects. At the top of the tree diagram above is the
root object, specified by 'url'="/". Objects farthest way from the root on a given branch are
called leaf objects. An example of a leaf object in the diagram is the object with
'url'="/amp/channel1/output" at bottom-right. All of the resources in a server are contained in
the leaf objects. The root and other non-leaf objects are just containers for other objects. In
terms of the API, this means that methods operate on leaves.

Many leaf objects support another level of hierarchy in the form of set of 'elements' that be
accessed via the message parameters. For such objects, there is a one-to-one correspondence
between parameters and elements. Essentially all of the audio processing objects are
constructed this way.

3|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

Websocket Info Requests:


All objects support the 'info' method, which can be used to obtain information about the
object, including the methods it supports, the elements it contains and the various element
attributes (type, min/max, units, etc.). A list of all parameters in the LEA Connect Series
Amplifiers can be found here: https://leaprofessional.com/wp-content/uploads/2020/05/LEA-
Connect-All-Websocket-Objects-May-2020.pdf

To obtain all parameters of the Connect Series Amplifiers, simply send this websocket request:

{
"leaApi": "1.0",
"url": "/",
"method": "info",
"params": {},
"id": 1
}

To obtain all the parameters for just the “amp” portion, simply send this websocket request:

{
"leaApi": "1.0",
"url": "/amp",
"method": "info",
"params": {},
"id": 1
}

To obtain all the parameters for just the “input” portion of the “amp,” simply send this
websocket request:

{
"leaApi": "1.0",
"url": "/amp/inputs",
"method": "info",
"params": {},
"id": 1
}

4|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

Websocket SET Requests:

After you have received the parameter’s info, it will tell you what each parameter supports
from a Get, Set, Subscribe or Unsubscribe standpoint. Here’s an example from the /amp/inputs
info request:

{
"leaApi": "1.0",
"url": "/amp/inputs",
"result": {
"dante": {
"1": {
"methods": [
"get",
"set",
"subscribe",
"unsubscribe"
],
}

In this case you can Get Channel 1 Dante information, you can Set Channel 1 Dante info, you
can Subscribe to Channel 1 Dante so if this changes, you will be notified, and if you’ve
subscribed to this parameter, you can unsubscribe.

Here’s and example to Get, Set, Subscribe and Unsubscribe to Channel 1 Output Level:
Channel 1 output level is located here /amp/channels/1/output. If we do an info request for
this url, we get the following information back from the amplifier for the output fader:

"fader": {
"type": "Float",
"control": true,
"min": -80.0,
"max": 0.0,
"default": 0.0,
"multipleOf": 0.10000000149011612,
"units": "dB"

5|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

Websocket SET Requests (continued):

This is saying the fader has a max value of 0dB, a min value of -80dB with increments of 0.1dB.
If I want to set the channel 1 output fader to -3.0dB, I send this SET command:

{
"leaApi": "1.0",
"url": "/amp/channels/1/output",
"method": "set",
"params": {"fader":-3.0},
"id": 1
}

The amplifier responds with the following websocket message to let you know channel 1
output fader has been set to -3.0dB:

{
"leaApi": "1.0",
"url": "/amp/channels/1/output",
"result": "OK",
"id": 1
}

Websocket GET, SUBSCRIBE, and UNSUBSCRIBE Requests:

To get the value for the channel 1 output to confirm the change was made, type the GET
command for channel 1 output:

{
"leaApi": "1.0",
"url": "/amp/channels/1/output",
"method": "get",
"params": {},
"id": 1
}

6|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

Once you send this GET Command, you receive the following information back from the
amplifier and you can confirm the output fader:

{
"leaApi": "1.0",
"url": "/amp/channels/1/output",
"result": {
"name": "OutputName",
"ZoneName": "ZoneName",
"enable": true,
"status": "Ok",
"mute": true,
"fader": -3.0,
"zoneFader": 0.0,
"backpanelPotAttn": 0.0,
"super8": false,
"hiZLoZ": "HiZ-100V",
"hiZHpfEnable": true,
"hiZHpfFrequency": 50.0,
"clipLimiterEnable": false,
"fault": false,
"thermal": false,
"limiting": false,
"clip": false,
"signalDetect": false,
"ready": true,
"autoStandbyActive": false
},
"id": 1
}

The channel 1 output fader object above supports methods 'get', 'set', 'subscribe' and
'unsubscribe'. The 'get' and 'set' messages need little explanation, except to note that the use
of 'get' is strongly discouraged in other than development and test scenarios. In place of 'get',
production clients should use 'subscribe', which is described later. Here are some
representative 'get' and 'set' requests, along with server responses:

7|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

The subscription messages serve two purposes:

• The values of some elements representing measured quantities (aka 'sensors') are
updated asynchronously when new measurement values are obtained (e.g. an audio
level meter). A client uses subscriptions to request server notifications when such
updates occur.
• In a multi-client environment, changes made by one client need to be seen by other
clients. The subscription mechanism is used to propogate such changes.

Server notifications contain the 'notify' method. Here is an example of a client subscribing to a
particular object:

'subscribe' request
{
"leaApi": "1.0",
"url": "/amp/channels/1/rmsLimiter",
"method": "subscribe",
"params": {},
"id": 13
}
{
"leaApi": "1.0",
"url": "/amp/channels/1/rmsLimiter",
"result": {
"enable": false,
"threshold": 151.0,
"attackTime": 0.019999999552965164,
"releaseTime": 0.0010000000474974513,
"gainReduction": -80.0,
"totalGainReduction": -80.0
},
"id": 13
}

8|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

subsequent changes to the object result in server notifications


{
"leaApi": "1.0",
"url": "/amp/channels/1/rmsLimiter",
"method": "set",
"params": {
"threshold": 153.0
}
}
{
"leaApi": "1.0",
"url": "/",
"method": "notify",
"params": {
"amp": {
"channels": {
"1": {
"rmsLimiter": {
"threshold": 153.0
}
}
}
}
}
}
'unsubscribe' request
{
"leaApi": "1.0",
"url": "/amp/channels/1/rmsLimiter",
"method": "unsubscribe",
"params": {},
"id": 14
}
{
"leaApi": "1.0",
"url": "/amp/channels/1/rmsLimiter",
"result": "OK",
"id": 14
}

9|Page
LEA Open API -
Websocket Protocol
Rev 1. 06-01-2020

Testing Websocket Commands from your Computer.

A good tool to use to test websockets from your computer is the Simple Websocket Client for
Google Chrome Browsers:

https://chrome.google.com/webstore/detail/simple-websocket-
client/pfdhoblngboilpfeibdedpjgfnlcodoo

For any questions, please contract techsupport@leaprofessional.com

10 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy