-
Notifications
You must be signed in to change notification settings - Fork 0
Websocket
RaHoni edited this page Apr 18, 2021
·
3 revisions
- https encrypted
- must be authenticated
- JSON encoded with the format:
{"Command":"<commandName>","Args":<args>} - Answer will be:
{"Command":"<commandName>","answer":<answer>}and always{"Command":"<commandName>","answer":<Success/Fail>}
- on Args:
{"percent": 0...1,id:"id"} - off Args:
{"id":"id"} - getRandomId: get a random free ID
- getController: get all Controller with their Ids and names
- getDevices: requesting All devices
- getDevice Args:
{"id":id}requesting all Information for a device - addDevice:
- mqtt Args:
{"id":"id", "name":"name", "switchType":"mqtt", "controlType":"button/slider"} - 433Mhz Args:
{"id":"id", "name":"name", "switchType":"433Mhz", "controlType":"button", "systemCode":"00000-11111", "unitCode":"00000-11111"}
- mqtt Args:
- updateDevice:
- mqtt Args:
{"oldId":"id", "newId":"id", "name":"name", "switchType":"mqtt", "controlType":"button/slider"} - 433Mhz Args:
{"oldId":"id", "newId":"id", "name":"name", "switchType":"433Mhz", "controlType":"button", "systemCode":"00000-11111", "unitCode":"00000-11111"}
- mqtt Args:
- statusChange Args:
{"id":"id",status:0...1} - getDevices Args:
{devices:[{<same data as addDevice>},...]} - getDevice Args:
{<same data as addDevice>} - newDevice Args:
{<same data as addDevice>} - getRandomId Args:
<id>[a-Z0-9]{5} - getController Args:
[{"masterId":<masterId>, "name":<name>}] "error":{"error":"msg","exeption":"Stacktrace"}

- Connect to server
- if client has a SessionID sends it to the server else step 4
- If SessionID is valid on the server you are authenticated else
- Client shows password dialog
- sends user credentials if they are correct
- Server authentication will send a SessionID along with
- Message for pass Auth
{"auth":"pass", "username":<username>, "pass":<password>} - Message for SessionID Auth
{"auth":"ID", "sessionID":<sessionID>}
Server answer: {"auth":<authtype>, "authenticated":<true/false>(, "sessionID":<sessionId>)} (if true)
- settingsMain Args:
{setting:"SettingsName", value:"value"}