mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-17 22:36:30 +00:00
Document ping and pong functionality (#191)
This commit is contained in:
parent
5563a61d68
commit
606b157561
@ -391,6 +391,26 @@ The server will respond with the image encoded via base64.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Pings and Pongs
|
||||||
|
|
||||||
|
The API supports receiving a ping from the client and returning a pong. This serves as a heartbeat to ensure the connection is still alive:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": 19,
|
||||||
|
"type": "ping"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The server must send a pong back as quickly as possible, if the connection is still active:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": 19,
|
||||||
|
"type": "pong"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
|
||||||
If an error occurs, the `success` key in the `result` message will be set to `false`. It will contain an `error` key containing an object with two keys: `code` and `message`.
|
If an error occurs, the `success` key in the `result` message will be set to `false`. It will contain an `error` key containing an object with two keys: `code` and `message`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user