Files
seweb/doc/protocol.txt
2024-09-10 08:56:13 +02:00

215 lines
5.3 KiB
Plaintext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***** ServerSentEvents *****
The only constantly open connection:
/updates
response: <id-message> <update-message> <redraw-message> <console-update-message> <graph-update-message>
the id-message is got immediately, later a mix of all other types of messages may be received
*********************************************************************************************************************************
<id-message> = {
"type": "id",
"id":<id>,
"title": <title>
}
<update-message> = {
"type": "update",
"updates": [{"name": <name0>, "value": <value0>}, ...]
}
<redraw-message> = {
"type": "redraw",
"path": <path>
}
<console-update-message> = {
"type": "command" | "reply",
"origin": "self" | "other",
"lines": <line>
}
<graph-update-message> = {
"type": "graph-update",
"time": <server-time>,
"graph": {
"<name1>": [[<time>,<value>],[<time>,<value>]...
"<name2>": [[<time>,<value>],[<time>,<value>]...
...
}
}
<graph-redraw-message> = {
"type": "graph-redraw"
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***** XMLHttp *****
All other connections are to be closed (getJSON or postForm):
*********************************************************************************************************************************
/getblock?path=<path>&id=<id>
response: <draw-message>
<draw-message> = {
"type": "draw",
"path": <path>,
"components": [<component0>, <component1>, ...]
}
*********************************************************************************************************************************
<component> = <input> | <rdonly> | <checkbox> | <radio-group>
<input> = {
"type": "input",
"name": <variable name>,
"title": <title>
<optional-attributes>
}
<rdonly> = {
"type": "rdonly",
"name": <variable name>,
"title": <title>
<optional-attributes>
}
<checkbox> = {
"type": "checkbox",
"name": <variable name>,
"title": <title>
<optional-attributes>
}
<radio-group> = {
"type": "radio",
"name": <variable name>,
"title": <title>,
"buttons": [{"value": <value0>, "title": <title0>} , ...],
<optional-attributes>
}
<optional-attributes> =
["info": <tool-tip-text> ,]
*********************************************************************************************************************************
/updateblock?path=<path>&id=<id>
response: <accept-block-message> (and from now on, update-messages (incl. initial updates) are sent)
<accept-block-message> = {
"type": "accept-block",
}
*********************************************************************************************************************************
/sendcommand?command=<command>&id=<id>
response: <accept-command-message>
<accept-command-message> = {
"type": "accept-command",
}
*********************************************************************************************************************************
/gettime?time=<start>,<end>&id=<id>
response: <time-message>
<time-message> = {
"type":"time",
"time": [<start>, <end>]
}
*********************************************************************************************************************************
POST (postForm)
/getvars
Parameters for this POST request are passed like this :
time=<time>&userconfiguration=<user_configuration>&id=<id>
response: <varlist-message>
<varlist-message> = {
"type":"var_list",
"device":<device_name>,
"blocks": [
{
"tag":"K_2",
"unit": "K",
"curves": [
{
"name":<name1>,
"label":<label1>,
"color":<color1>
},
{
"name":<name2>,
...
} ...
]
},
{
"tag":"mbar",
"unit": "mbar",
"curves": ...
},
...
]
}
*********************************************************************************************************************************
/updategraph?id=<id>
response: <accept-graph-message>
<accept-graph-message> = = {
"type": "accept-graph",
"live": true/false
}
the "live" flag is true when the last /graph query was including the actual time
*********************************************************************************************************************************
/graph?time=<start>,<end>&variables=<variable list>&interval=<interval>&id=<id>
response: <graph-draw-message>
<graph-draw-message> = = {
"type": "graph-draw",
"graph": {
"<name1>": [[<time>,<value>],[<time>,<value>]...
"<name2>": [[<time>,<value>],[<time>,<value>]...
...
}
*********************************************************************************************************************************
/console?id=<id>
response: <accept-console-message> (and from now on, console-updates-messages (incl. history) are sent)
<accept-console-message> = {
"type": "accept-console",
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***** Special route *****
/export?time=<start>,<end>&variables=<selected_variables>&nan=<nan_representation>&interval=<binning_value>&id=<id>
This route is reached via a programatically triggered click on an <a> element (GET request)