# Websocket
there are 2
- terminal websocket
used to stream data to webUIand exchange internal data
- data websocket
used to exchange data
## Terminal websocket
subprotocol: `webui-v3`
port: webport number + 1
### text mode
Reserved
messages between webui / ESP
Format: `:`
- from ESP to WebUI
- `currentID:`
Sent when client is connecting, it is the last ID used and become the active ID
- `activeID:`
Broadcast current active ID, when new client is connecting, client without this is should close, ESP WS Server close all open WS connections but this one also
- `PING::`
It is a response to PING from client to inform the time left if no activity (see below)
- `ERROR::`
If an error raise when doing upload, it informs client it must stop uploading because sometimes the http answer is not possible,
or cannot cancel the upload, this is a workaround as there is no API in current webserver to cancel active upload
- `NOTIFICATION:`
Forward the message sent by [ESP600] to webUI toast system
- `SENSOR: [] [] ...`
The sensor connected to ESP like DHT22
- from WebUI to ESP
- `PING:` if any, or "none" if none
### binary mode
Reserved
- from ESP to WebUI
stream data from ESP to WebUI
- from WEBUI to ESP
[-> File transfert from WebUI to ESP : not implemented yet]
## Data websocket
protocol: `arduino`
port: configurable in settings
### text mode
Free to use
### binary mode
Free to use