Added doc for ws.enable and ws.enabled (#33)
This commit is contained in:
parent
2b501e74a7
commit
26b2e2532b
33
README.md
33
README.md
|
@ -625,3 +625,36 @@ void setup(){
|
|||
|
||||
void loop(){}
|
||||
```
|
||||
|
||||
### Methods for controlling websocket connections
|
||||
|
||||
```arduino
|
||||
// Disable client connections if it was activated
|
||||
if ( ws.enabled() )
|
||||
ws.enable(false);
|
||||
|
||||
// enable client connections if it was disabled
|
||||
if ( !ws.enabled() )
|
||||
ws.enable(true);
|
||||
```
|
||||
|
||||
Example of OTA code
|
||||
|
||||
```arduino
|
||||
// OTA callbacks
|
||||
ArduinoOTA.onStart([]() {
|
||||
// Clean SPIFFS
|
||||
SPIFFS.end();
|
||||
|
||||
// Disable client connections
|
||||
ws.enable(false);
|
||||
|
||||
// Advertise connected clients what's going on
|
||||
ws.textAll("OTA Update Started");
|
||||
|
||||
// Close them
|
||||
ws.closeAll();
|
||||
|
||||
});
|
||||
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue