From 26b2e2532b5fbf78ed16bead9d3ef0b516e7a357 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 25 May 2016 20:13:26 +0200 Subject: [PATCH] Added doc for ws.enable and ws.enabled (#33) --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 59d0ee1..1a15829 100644 --- a/README.md +++ b/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(); + + }); + +```