Initial Ktor backend skeleton with ProtocolMessage DTO, REST and WebSocket
This commit is contained in:
13
protocol/examples/command.json
Normal file
13
protocol/examples/command.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"v": 1,
|
||||
"id": "cmd-123",
|
||||
"type": "command",
|
||||
"ts": 1710000000,
|
||||
"deviceId": "esp32-001",
|
||||
"payload": {
|
||||
"command": "setRelay",
|
||||
"params": {
|
||||
"state": true
|
||||
}
|
||||
}
|
||||
}
|
||||
12
protocol/examples/event.json
Normal file
12
protocol/examples/event.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"v": 1,
|
||||
"id": "evt-123",
|
||||
"type": "event",
|
||||
"ts": 1710000003,
|
||||
"deviceId": "esp32-001",
|
||||
"payload": {
|
||||
"event": "overheat",
|
||||
"level": "warning",
|
||||
"message": "Temperature too high"
|
||||
}
|
||||
}
|
||||
12
protocol/examples/response.json
Normal file
12
protocol/examples/response.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"v": 1,
|
||||
"id": "resp-123",
|
||||
"type": "response",
|
||||
"ts": 1710000001,
|
||||
"deviceId": "esp32-001",
|
||||
"payload": {
|
||||
"requestId": "cmd-123",
|
||||
"status": "ok",
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
12
protocol/examples/telemetry.json
Normal file
12
protocol/examples/telemetry.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"v": 1,
|
||||
"id": "tel-123",
|
||||
"type": "telemetry",
|
||||
"ts": 1710000002,
|
||||
"deviceId": "esp32-001",
|
||||
"payload": {
|
||||
"voltage": 220.5,
|
||||
"current": 1.2,
|
||||
"temperature": 36.6
|
||||
}
|
||||
}
|
||||
12
protocol/schema.json
Normal file
12
protocol/schema.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["v", "id", "type", "ts", "deviceId", "payload"],
|
||||
"properties": {
|
||||
"v": { "type": "integer" },
|
||||
"id": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"ts": { "type": "integer" },
|
||||
"deviceId": { "type": "string" },
|
||||
"payload": { "type": "object" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user