Added doc for ws.enable and ws.enabled (#33)

This commit is contained in:
Charles 2016-05-25 20:13:26 +02:00 committed by Me No Dev
parent 2b501e74a7
commit 26b2e2532b
1 changed files with 33 additions and 0 deletions

View File

@ -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();
});
```