how should i interface EEPROM in WEBSOCKET

Hello Sir,
I am at beginner level and i wanted to implement EEPROM write after receiving data from websocket if websocket doenst receive any data within 5 seconds then the value which i have sent via websocket to turn on and off led here LED_STATE want to write it to EEPROM after 5 seconds if there will be no incoming data from websocket :
Here is my code please if you can help me out to solve this problem thank you.
I have modified as per my need.
but require EEPROM for websocket if possible.

#include <ESP8266WiFi.h>
#include <WebSocketsServer.h>
#include <Hash.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>

WiFiServer server(80);
WebSocketsServer webSocket = WebSocketsServer(81);

const int pin_led = 5;
unsigned int value;
String data;
const char *msg_toggle_led = "toggleLED";
const char *msg_get_led = "getLEDState";
char msg_buf[10];
int led_state = 0;
int counter = 0; // for EEPROM testing

char* ssid = "esp8266websocket_1";
char* password = "123456789";

void setup()
{
// EEPROM.begin(512);
pinMode(pin_led, OUTPUT);
digitalWrite(pin_led,LOW);

Serial.begin(115200);
Serial.println();
Serial.println("Serial started at 115200");
Serial.println();

// Connect to a WiFi network
Serial.print(F("Connecting to ")); Serial.println(ssid);
WiFi.mode(WIFI_AP);
IPAddress apLocalIp(10,50,1,1);
IPAddress apSubnetMask(255,255,255,0);
WiFi.softAPConfig(apLocalIp,apLocalIp,apSubnetMask);
WiFi.softAP(ssid, password);
WiFi.setSleepMode(WIFI_NONE_SLEEP);

Serial.println("");
Serial.println(F("[CONNECTED]")); Serial.print("[IP "); Serial.print(WiFi.localIP());
Serial.println("]");

// start a server
server.begin();
Serial.println("Server started");
webSocket.begin();
webSocket.onEvent(onWebSocketEvent);
//Serial.print(webSocket.localIP());

}

void loop()
{
webSocket.loop();

}

// Called when receiving any WebSocket message
void onWebSocketEvent(uint8_t client_num,
WStype_t type,
uint8_t * payload,
size_t length) {

// Figure out the type of WebSocket event
switch(type) {

// Client has disconnected
case WStype_DISCONNECTED:
  Serial.printf("[%u] Disconnected!\n", client_num);
  break;

// New client has connected
case WStype_CONNECTED:
  {
    IPAddress ip = webSocket.remoteIP(client_num);
    Serial.printf("[%u] Connection from ", client_num);
    Serial.println(ip.toString());
  }
  break;

// Echo text message back to client
case WStype_TEXT:
  Serial.printf("[%u] Text: %s\n", client_num, payload);
  webSocket.sendTXT(client_num, payload);
 // data = webSocket.getData(payload);
 
  Serial.printf("[%u] Received text: %s\n", client_num, payload);

  // Toggle LED
  if ( strcmp((char *)payload, "toggleLED") == 0 ) {
    counter++;
    led_state = led_state ? 0 : 1;
    //sprintf(msg_buf, "%d", led_state);
    Serial.printf("Toggling LED to %u\n", led_state);
    digitalWrite(pin_led, led_state);
   // webSocket.sendTXT(client_num, msg_buf);

  // Report the state of the LED
  } else if ( strcmp((char *)payload, "getLEDState") == 0 ) {
    sprintf(msg_buf, "%d", led_state);
    Serial.printf("Sending to [%u]: %s\n", client_num, msg_buf);
    webSocket.sendTXT(client_num, msg_buf);
    
  // Message not recognized
  } else {
    Serial.println("[%u] Message not recognized");
  }
 
  break;

// For everything else: do nothing
case WStype_BIN:
case WStype_ERROR:
case WStype_FRAGMENT_TEXT_START:
case WStype_FRAGMENT_BIN_START:
case WStype_FRAGMENT:
case WStype_FRAGMENT_FIN:
default:
  break;
}

}

I am not using SPIFFS i am calling webpage in HTML which is

/////<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>/////

<style>
input[type="text"]{
width: 90%;
height: 3vh;
}

input[type="button"]{
width: 9%;
height: 3.6vh;
}

.rxd{
height: 90vh;
}

textarea {
width: 99%;
height: 100%;
resize: none;
}

</style> <script> var Socket; function start() { Socket = new WebSocket('ws://10.50.1.1:81/'); Socket.onmessage = function(evt) { document.getElementById("rxConsole").value += evt.data; } } function enterpressed() { Socket.send(document.getElementById("txbuff").value); document.getElementById("txbuff").value = ""; } </script>

<textarea id="rxConsole" readonly></textarea>

<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
please help to implement EEPROM in WEBSOCKET because if websocket starts it stays there as long as clients are connected. so need help to implement websocket for ToggleLED status save data after 5 second if there is no data coming from html webpage.
please help if possible thank you all.

presumably you understand how to write data to the EEPROM, know what you want to write and which address to write to in the EEPROM.

the problem is recognizing that 5 seconds has gone by without receiving anything from the socket.

you can used millis() to capture a timestamp whenever you receive something from the socket.

msecLastSckt = millis();

Elsewhere, you can use millis() to capture the current time and check if the time since the last receiving something from the socket > 5000 msec AND that you haven't already processes this event. If > 5 sec and haven't processed the event, write data to EEPROM.

if (!state && millis() - msecLastSckt > 5000) {
      state = 1
     // write to EEPROM
     ....
}

Yes Sir,
I have understood about the EEPROM write ,read and how many address bytes do i required to store data. out of 512 bytes.
Thank you sir, I will perform some testings on your given code.

Sir I have applied as per you told me but if i change value after 5 seconds then only it will be writting the data on eeprom other wise its fine i mean when i will stop sending data it after more than 5 seconds when i will start sending data again it will store value in eeprom at that time. not before that.
how to solve this.

i am using websocket and here is my code:

else if (!jsonObject.isNull() && jsonObject.containsKey("Slider1")) {
          JsonObject bulbObject = jsonObject.getMember("Slider1");
          cctSlider1 = bulbObject["Value"].as<int>();
          isSliding = (const char*)bulbObject["Sliding"];
          Serial.println(isSliding + " received msgsld " + cctSlider1 + " from " + client_num);
          old_cct1 = cctSlider1;
          CCTLED_function(cctSlider1);
          
          

          if (!isSliding.equals("true")) {
            Serial.println("false");
            state = 0;
            sendALL(((char *)payload), String(client_num + 1));
          } 
          else if(!state && millis() - msecLastSckt > 5000) {
               state = 1; 
              // write to EEPROM
              Serial.println("EEPROM write operation1");
              
          
          }
          else  {
            Serial.println("true");
            msecLastSckt = millis();
            state = 1;
            JsonObject jsonObject = doc2.to<JsonObject>();
            JsonObject ServerObject = jsonObject.createNestedObject("isSliding");
            ServerObject["Sliding"] = "true";
            String output;
            serializeJson(doc2, output);
            Serial.println(" output: " + output);
            //  webSocket.sendTXT(client_num+1, output);
            sendALL((output), String(client_num + 1));
             }[\code]

when i will stop sending data it after more than 5 seconds when i will start sending data again it will store value in eeprom at that time. not before that.

are you saying nothing is written to EEPROM until after receiving data?

need to see how you are using millis()?

else if (!jsonObject.isNull() && jsonObject.containsKey("Slider1")) {
          JsonObject bulbObject = jsonObject.getMember("Slider1");
          cctSlider1 = bulbObject["Value"].as<int>();
          isSliding = (const char*)bulbObject["Sliding"];
          Serial.println(isSliding + " received msgsld " + cctSlider1 + " from " + client_num);
          old_cct1 = cctSlider1;
          CCTLED_function(cctSlider1);
          
          if (!isSliding.equals("true")) {
            Serial.println("false");
            state = 0;
            sendALL(((char *)payload), String(client_num + 1));
          } 
          else if(!state && millis() - msecLastSckt > 5000) {
               state = 1; 
              // write to EEPROM
              Serial.println("EEPROM write operation1");
          }
         
          else {
            Serial.println("true");
            msecLastSckt = millis();
            state = 1;
            JsonObject jsonObject = doc2.to<JsonObject>();
            JsonObject ServerObject = jsonObject.createNestedObject("isSliding");
            ServerObject["Sliding"] = "true";
            String output;
            serializeJson(doc2, output);
            Serial.println(" output: " + output);
            //  webSocket.sendTXT(client_num+1, output);
            sendALL((output), String(client_num + 1));
             }
          }

Sir here is my code when i receive data from web socket which will give me "True" every time i slide my range slider on App after i stop sliding it further ,when it will stop it will send me "False". so after false comes, my millis() function will run for 5 seconds in between 5 seconds what if there is no data coming from my app and it stays "false". then write it to EEPROM that slider value. but if i will get "true" in between 5 seconds then reset the millis(). or maybe we can use counter but how to implement it kindly guide me or else edit this code please if possible, Thank you

only reset "msecLastSckt" when you receive data (when you set state to 0)

          else {
            Serial.println("true");
            msecLastSckt = millis();

Respected Sir,

Here is my full code:

void onWebSocketEvent(uint8_t client_num, WStype_t type, uint8_t * payload, size_t length) { // main loop for websocket.
  yield();
  // Figure out the type of WebSocket event
  switch (type) {

    // Client has disconnected
    case WStype_DISCONNECTED:
      Serial.printf("[%u] Disconnected!\n", client_num);
      // newClient.disconnect();
      removeClient(client_num + 1); //remove client if its disconnects.
      printClient();
      Serial.print("client disconnected>> -");
      Serial.println(client_num);

      if (!checkClient()) {
        mainSwitch = "HomeFragment";
        Serial.println(mainSwitch);
      }

      break;


    // New client has connected
    case WStype_CONNECTED:
      {
        IPAddress ip = webSocket.remoteIP(client_num);
        Serial.printf("[%u] Connection from ", client_num);
        Serial.println(ip.toString());
        clients_num[addClient()] = client_num + 1;
        printClient();                  // print client if its connected.
        Serial.print("client connected>> -");
        Serial.println(client_num);
        JsonObject jsonObject = doc3.to<JsonObject>();
        JsonObject ServerObject = jsonObject.createNestedObject("ServerValue");
        ServerObject["Bulb"] = ledState;
        ServerObject["Slider1"] = String(cctSlider1);
        ServerObject["Slider2"] = String(cctSlider2);
        ServerObject["ColorSlider"] = colorSlider;
        ServerObject["ColorSlider1"] = String(colorSlider1);
        ServerObject["ColorSlider2"] = String(colorSlider2);
        ServerObject["MainSwitch"] = mainSwitch;
        ServerObject["Sliding"] = isSliding;
        String output;
        serializeJson(doc3, output);
        webSocket.sendTXT(client_num, output);  //serialize and send initial data to the app. serverobject via Json.

      }
      break;

    // Echo text message back to client
    case WStype_TEXT:                                                  // main data receive and transmitt via this case.
      Serial.printf("[%u] Text: %s\n", client_num, payload);
      if (isJSONValid(String((char *)payload))) {
        JsonObject jsonObject = doc.as<JsonObject>();

        if (!jsonObject.isNull() && jsonObject.containsKey("Bulb")) {
          JsonObject bulbObject = jsonObject.getMember("Bulb");
          ledState = (const char*)bulbObject["State"];
          Serial.println("received msg " + ledState + " from " + client_num);
          if (ledState == "OFF")
          {
            analogWrite(pin_dimm, 0);  // turn off led
          }
          else if (ledState == "ON") {
            analogWrite(pin_dimm, cctSlider1); // turn on to slider value.
          }
          sendALL(((char *)payload), "All"); //session.getId()
        }
        else if (!jsonObject.isNull() && jsonObject.containsKey("Slider1")) {
          JsonObject bulbObject = jsonObject.getMember("Slider1");
          cctSlider1 = bulbObject["Value"].as<int>();
          isSliding = (const char*)bulbObject["Sliding"];
          Serial.println(isSliding + " received msgsld " + cctSlider1 + " from " + client_num);
          old_cct1 = cctSlider1;
          CCTLED_function(cctSlider1);
          if (!isSliding.equals("true")) {
            Serial.println("false");
            
            sendALL(((char *)payload), String(client_num + 1));
          } 
          else if(!state && millis() - msecLastSckt > 5000) {
               state = 1; 
              // write to EEPROM
              Serial.println("EEPROM write operation1");
          }
         
           else {
            Serial.println("true");
            msecLastSckt = millis();
            state = 0;
            JsonObject jsonObject = doc2.to<JsonObject>();
            JsonObject ServerObject = jsonObject.createNestedObject("isSliding");
            ServerObject["Sliding"] = "true";
            String output;
            serializeJson(doc2, output);
            Serial.println(" output: " + output);
            //  webSocket.sendTXT(client_num+1, output);
            sendALL((output), String(client_num + 1));
             }
           
          }

sir can you please edit because i have tried everything but it seems to not working as i wanted please edit or elaborate thank you!

else if (!jsonObject.isNull() && jsonObject.containsKey("Slider1")) {
          JsonObject bulbObject = jsonObject.getMember("Slider1");
          cctSlider1 = bulbObject["Value"].as<int>();
          isSliding = (const char*)bulbObject["Sliding"];
          Serial.println(isSliding + " received msgsld " + cctSlider1 + " from " + client_num);
          old_cct1 = cctSlider1;
          CCTLED_function(cctSlider1);

          if (!isSliding.equals("true")) {
            Serial.println("false");
            state = 0;
            msecLastSckt = millis();
            sendALL(((char *)payload), String(client_num + 1));
          }
          else if(!state && millis() - msecLastSckt > 5000) {
               state = 1;
              // write to EEPROM
              Serial.println("EEPROM write operation1");
          }

          else {
            Serial.println("true");
 //         msecLastSckt = millis();
 //         state = 1;
            JsonObject jsonObject = doc2.to<JsonObject>();
            JsonObject ServerObject = jsonObject.createNestedObject("isSliding");
            ServerObject["Sliding"] = "true";
            String output;
            serializeJson(doc2, output);
            Serial.println(" output: " + output);
            //  webSocket.sendTXT(client_num+1, output);
            sendALL((output), String(client_num + 1));
             }
          }
09:54:09.403 -> [1] Text: {"Slider1":{"Value":"706","Sliding":"true"}}
09:54:09.403 -> 0
09:54:09.403 -> true received msgsld 706 from 1
09:54:09.403 -> dim pin :706
09:54:09.403 -> true
09:54:09.403 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:09.437 -> [1] Text: {"Slider1":{"Value":"706","Sliding":"false"}}
09:54:09.437 -> 0
09:54:09.437 -> false received msgsld 706 from 1
09:54:09.437 -> dim pin :706
09:54:09.437 -> false
09:54:09.736 -> [1] Text: {"Slider1":{"Value":"682","Sliding":"true"}}
09:54:09.736 -> 0
09:54:09.736 -> true received msgsld 682 from 1
09:54:09.736 -> dim pin :682
09:54:09.736 -> true
09:54:09.736 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:09.971 -> [1] Text: {"Slider1":{"Value":"682","Sliding":"false"}}
09:54:09.971 -> 0
09:54:09.971 -> false received msgsld 682 from 1
09:54:09.971 -> dim pin :682
09:54:09.971 -> false
09:54:10.437 -> [1] Text: {"Slider1":{"Value":"659","Sliding":"true"}}
09:54:10.437 -> 0
09:54:10.437 -> true received msgsld 659 from 1
09:54:10.437 -> dim pin :659
09:54:10.437 -> true
09:54:10.437 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:10.437 -> [1] Text: {"Slider1":{"Value":"659","Sliding":"false"}}
09:54:10.437 -> 0
09:54:10.437 -> false received msgsld 659 from 1
09:54:10.437 -> dim pin :659
09:54:10.437 -> false
09:54:10.437 -> [1] Text: {"Slider1":{"Value":"621","Sliding":"true"}}
09:54:10.437 -> 0
09:54:10.437 -> true received msgsld 621 from 1
09:54:10.437 -> dim pin :621
09:54:10.437 -> true
09:54:10.437 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:10.470 -> [1] Text: {"Slider1":{"Value":"621","Sliding":"false"}}
09:54:10.470 -> 0
09:54:10.470 -> false received msgsld 621 from 1
09:54:10.470 -> dim pin :621
09:54:10.470 -> false
09:54:10.838 -> [1] Text: {"Slider1":{"Value":"597","Sliding":"true"}}
09:54:10.838 -> 0
09:54:10.838 -> true received msgsld 597 from 1
09:54:10.838 -> dim pin :597
09:54:10.838 -> true
09:54:10.838 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:10.838 -> [1] Text: {"Slider1":{"Value":"597","Sliding":"false"}}
09:54:10.838 -> 0
09:54:10.838 -> false received msgsld 597 from 1
09:54:10.838 -> dim pin :597
09:54:10.838 -> false
09:54:11.106 -> [1] Text: {"Slider1":{"Value":"582","Sliding":"true"}}
09:54:11.106 -> 0
09:54:11.106 -> true received msgsld 582 from 1
09:54:11.106 -> dim pin :582
09:54:11.106 -> true
09:54:11.106 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:11.207 -> [1] Text: {"Slider1":{"Value":"582","Sliding":"false"}}
09:54:11.207 -> 0
09:54:11.207 -> false received msgsld 582 from 1
09:54:11.207 -> dim pin :582
09:54:11.207 -> false
09:54:11.773 -> [1] Text: {"Slider1":{"Value":"605","Sliding":"true"}}
09:54:11.773 -> 0
09:54:11.773 -> true received msgsld 605 from 1
09:54:11.773 -> dim pin :605
09:54:11.773 -> true
09:54:11.773 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:11.973 -> [1] Text: {"Slider1":{"Value":"605","Sliding":"false"}}
09:54:11.973 -> 0
09:54:11.973 -> false received msgsld 605 from 1
09:54:11.973 -> dim pin :605
09:54:11.973 -> false
09:54:12.273 -> [1] Text: {"Slider1":{"Value":"667","Sliding":"true"}}
09:54:12.273 -> 0
09:54:12.273 -> true received msgsld 667 from 1
09:54:12.273 -> dim pin :667
09:54:12.273 -> true
09:54:12.273 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:12.273 -> [1] Text: {"Slider1":{"Value":"667","Sliding":"false"}}
09:54:12.273 -> 0
09:54:12.273 -> false received msgsld 667 from 1
09:54:12.273 -> dim pin :667
09:54:12.273 -> false
09:54:12.508 -> [1] Text: {"Slider1":{"Value":"752","Sliding":"true"}}
09:54:12.508 -> 0
09:54:12.508 -> true received msgsld 752 from 1
09:54:12.508 -> dim pin :752
09:54:12.508 -> true
09:54:12.508 ->  output: {"isSliding":{"Sliding":"true"}}
09:54:12.880 -> [1] Text: {"Slider1":{"Value":"752","Sliding":"false"}}
09:54:12.880 -> 0
09:54:12.880 -> false received msgsld 752 from 1
09:54:12.880 -> dim pin :752
09:54:12.880 -> false
09:54:19.125 -> [1] Text: {"Slider1":{"Value":"845","Sliding":"true"}}
09:54:19.125 -> 0
09:54:19.125 -> true received msgsld 845 from 1
09:54:19.125 -> dim pin :845
09:54:19.125 -> EEPROM write operation1
09:54:19.627 -> [1] Text: {"Slider1":{"Value":"845","Sliding":"false"}}
09:54:19.627 -> 0
09:54:19.627 -> false received msgsld 845 from 1
09:54:19.627 -> dim pin :845
09:54:19.627 -> false
09:54:27.560 -> [1] Text: {"CurrentFragment":{"switchTo":"HomeFragment"}}
09:54:27.560 -> 0
09:54:27.560 -> dim pin :845
09:54:27.560 -> received msg CCTFragment from 1
09:54:42.175 -> [1] Disconnected!

Sir here it is on serial monitor "EEPROM write operation1" starts after i slide the slider again after 5 seconds when it comes "true". as per your guidance. with time stamp. can you please guide me as i am new and need to learn it as soon as possible thank you!.

can you post both the code and serial output?

if i understand the output correctly, there should have been an EEPROM write at 0:54.17.88

void onWebSocketEvent(uint8_t client_num, WStype_t type, uint8_t * payload, size_t length) { // main loop for websocket.
  yield();
  // Figure out the type of WebSocket event
  switch (type) {

    // Client has disconnected
    case WStype_DISCONNECTED:
      Serial.printf("[%u] Disconnected!\n", client_num);
      // newClient.disconnect();
      removeClient(client_num + 1); //remove client if its disconnects.
      printClient();
      Serial.print("client disconnected>> -");
      Serial.println(client_num);

      if (!checkClient()) {
        mainSwitch = "HomeFragment";
        Serial.println(mainSwitch);
      }

      break;


    // New client has connected
    case WStype_CONNECTED:
      {
        IPAddress ip = webSocket.remoteIP(client_num);
        Serial.printf("[%u] Connection from ", client_num);
        Serial.println(ip.toString());
        clients_num[addClient()] = client_num + 1;
        printClient();                  // print client if its connected.
        Serial.print("client connected>> -");
        Serial.println(client_num);
        JsonObject jsonObject = doc3.to<JsonObject>();
        JsonObject ServerObject = jsonObject.createNestedObject("ServerValue");
        ServerObject["Bulb"] = ledState;
        ServerObject["Slider1"] = String(cctSlider1);
        ServerObject["Slider2"] = String(cctSlider2);
        ServerObject["ColorSlider"] = colorSlider;
        ServerObject["ColorSlider1"] = String(colorSlider1);
        ServerObject["ColorSlider2"] = String(colorSlider2);
        ServerObject["MainSwitch"] = mainSwitch;
        ServerObject["Sliding"] = isSliding;
        String output;
        serializeJson(doc3, output);
        webSocket.sendTXT(client_num, output);  //serialize and send initial data to the app. serverobject via Json.

      }
      break;

    // Echo text message back to client
    case WStype_TEXT:                                                  // main data receive and transmitt via this case.
      Serial.printf("[%u] Text: %s\n", client_num, payload);
      if (isJSONValid(String((char *)payload))) {
        JsonObject jsonObject = doc.as<JsonObject>();

        if (!jsonObject.isNull() && jsonObject.containsKey("Bulb")) {
          JsonObject bulbObject = jsonObject.getMember("Bulb");
          ledState = (const char*)bulbObject["State"];
          Serial.println("received msg " + ledState + " from " + client_num);
          if (ledState == "OFF")
          {
            analogWrite(pin_dimm, 0);  // turn off led
          }
          else if (ledState == "ON") {
            analogWrite(pin_dimm, cctSlider1); // turn on to slider value.
          }
          sendALL(((char *)payload), "All"); //session.getId()
        }
        else if (!jsonObject.isNull() && jsonObject.containsKey("Slider1")) {
          JsonObject bulbObject = jsonObject.getMember("Slider1");
          cctSlider1 = bulbObject["Value"].as<int>();
          isSliding = (const char*)bulbObject["Sliding"];
          Serial.println(isSliding + " received msgsld " + cctSlider1 + " from " + client_num);
          old_cct1 = cctSlider1;
          CCTLED_function(cctSlider1);
          
          if (!isSliding.equals("true")) {
            Serial.println("false");
            state = 0;
            msecLastSckt = millis();
            sendALL(((char *)payload), String(client_num + 1));
          } 
          else if(!state && millis() - msecLastSckt > 5000) {
               state = 1; 
              // write to EEPROM
              Serial.println("EEPROM write operation1");
              delay(500);
          }
         
          
         else {
            Serial.println("true");
           // state = 1;
           // msecLastSckt = millis();
            JsonObject jsonObject = doc2.to<JsonObject>();
            JsonObject ServerObject = jsonObject.createNestedObject("isSliding");
            ServerObject["Sliding"] = "true";
            String output;
            serializeJson(doc2, output);
            Serial.println(" output: " + output);
            //  webSocket.sendTXT(client_num+1, output);
            sendALL((output), String(client_num + 1));
             } 
          
          
        }

}
       
      break;

    // For everything else: do nothing
    case WStype_BIN:
    case WStype_ERROR:
    case WStype_FRAGMENT_TEXT_START:
    case WStype_FRAGMENT_BIN_START:
    case WStype_FRAGMENT:
    case WStype_FRAGMENT_FIN:
    default:
      break;
  }

}

bool isJSONValid(String text) {
  deserializeJson(doc, text);
  JsonObject object = doc.as<JsonObject>();
  Serial.println(object.isNull());
  if (object.isNull()) {
    JsonArray arr = doc.as<JsonArray>();
    Serial.println(object.isNull());
    if (object.isNull()) {
      return false;
    }

  }
  return true;
}

Sir here I am using WEBSOCKET ,in that my device will stay connected all the time until i disconnect.
So here when i will use slider ill get data of slider via JSON object via android app and JSON object comes with string so exactly i have got the value to parse into my arduino code to change my LED PWM so here is my whole code and also updated my serial output

16:32:22.715 -> [0] Connection from 10.50.1.100
16:32:22.715 -> 
16:32:22.715 ->  afterclients_num[i]= 1 condition= 0
16:32:22.715 ->  afterclients_num[i]= 0 condition= 1
16:32:22.715 ->  afterclients_num[i]= 0 condition= 2
16:32:22.715 ->  afterclients_num[i]= 0 condition= 3
16:32:22.715 ->  afterclients_num[i]= 0 condition= 4client connected>> -0
16:32:22.715 -> [0] Text: {"BulbState":{"State":"OFF"}}
16:32:22.715 -> 0
16:32:24.294 -> [0] Text: {"CurrentFragment":{"switchTo":"CCTFragment"}}
16:32:24.294 -> 0
16:32:24.294 -> dim pin :0
16:32:24.294 -> received msg CCTFragment from 0
16:32:28.063 -> [0] Text: {"Slider1":{"Value":"280","Sliding":"true"}}
16:32:28.063 -> 0
16:32:28.063 -> true received msgsld 280 from 0
16:32:28.063 -> dim pin :280
16:32:28.063 -> true
16:32:28.063 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:28.700 -> [0] Text: {"Slider1":{"Value":"304","Sliding":"true"}}
16:32:28.700 -> 0
16:32:28.700 -> true received msgsld 304 from 0
16:32:28.700 -> dim pin :304
16:32:28.700 -> true
16:32:28.700 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:28.768 -> [0] Text: {"Slider1":{"Value":"311","Sliding":"true"}}
16:32:28.768 -> 0
16:32:28.768 -> true received msgsld 311 from 0
16:32:28.768 -> dim pin :311
16:32:28.768 -> true
16:32:28.768 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:28.970 -> [0] Text: {"Slider1":{"Value":"319","Sliding":"true"}}
16:32:28.970 -> 0
16:32:28.970 -> true received msgsld 319 from 0
16:32:28.970 -> dim pin :319
16:32:28.970 -> true
16:32:28.970 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:29.275 -> [0] Text: {"Slider1":{"Value":"327","Sliding":"true"}}
16:32:29.275 -> 0
16:32:29.275 -> true received msgsld 327 from 0
16:32:29.275 -> dim pin :327
16:32:29.275 -> true
16:32:29.275 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:29.376 -> [0] Text: {"Slider1":{"Value":"335","Sliding":"true"}}
16:32:29.376 -> 0
16:32:29.376 -> true received msgsld 335 from 0
16:32:29.376 -> dim pin :335
16:32:29.376 -> true
16:32:29.376 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:29.577 -> [0] Text: {"Slider1":{"Value":"342","Sliding":"true"}}
16:32:29.577 -> 0
16:32:29.577 -> true received msgsld 342 from 0
16:32:29.577 -> dim pin :342
16:32:29.577 -> true
16:32:29.577 ->  output: {"isSliding":{"Sliding":"true"}}
16:32:29.744 -> [0] Text: {"Slider1":{"Value":"342","Sliding":"false"}}
16:32:29.744 -> 0
16:32:29.744 -> false received msgsld 342 from 0
16:32:29.744 -> dim pin :342
16:32:29.744 -> false
16:32:35.367 -> [0] Text: {"Slider1":{"Value":"396","Sliding":"true"}}
16:32:35.367 -> 0
16:32:35.367 -> true received msgsld 396 from 0
16:32:35.367 -> dim pin :396
16:32:35.367 -> EEPROM write operation1
16:32:35.873 -> [0] Text: {"Slider1":{"Value":"396","Sliding":"false"}}
16:32:35.873 -> 0
16:32:35.873 -> false received msgsld 396 from 0
16:32:35.873 -> dim pin :396
16:32:35.873 -> false

this is my serial output

And yes sir you are right
"if i understand the output correctly, there should have been an EEPROM write at 0:54.17.88"
but it does not print out at that moment

gcjr:
can you post both the code and serial output?

if i understand the output correctly, there should have been an EEPROM write at 0:54.17.88

the code to write to the EEPROM when there isn't a socket message for 5 sec must be outside of any code that is waiting for a socket message. the code to reset the state and msecLast doesn't need to be in the code to process a socket message, it can be reset when the function that does process the message is called.

i don't see a main() and where onWebSocketEvent() is called, so this doesn't look like the entire code.

as i've tried to explain, the code to write to the EEPROM after not receiving a socket "event" for 5 secs must not be in the code that processes the "event" you have not received

i would suggest that the code to write to the EEPROM be moved from onWebSocketEvent() to loop().

the code that resets the state and msecLast should be in onWebSocketEvent(), but seeing more of the code, I see it may depend on the type of event. I would think CONNECTED and TEST events should reset state. not sure about DISCONNECTED.

It make sense to have separate sub-functions to reset the state/msecLast and to check them and possibly write to EEPROM. this would allow those functions to be called for multiple cases. (i think setting state to 1 for the DISCONNECTED case may be appropriate).

i hope this explanation is clear to you.

can you please make an attempt to implement what i'm suggesting. this logic shouldn't be difficult to understand.

Yes sir as per your suggestions i will implement and also if i get disconnect my device then only my websocket loop ends and main loop () functions normally.

Yes sir i will try to implement as per your guidance and suggestions and letting you know about the process, Thank you sir.

Respected Sir,
I have managed to implement eeprom write after the disconnection of the device but what i will be needing further is:
When i will use slider value comes : "true" all the time, but if i stop moving slider then it will comes "false".
so when the false comes my millis() will check if 5 seconds gone or not. as per your code but after 5 seconds it wont save to eeprom as we have discussed earlier. its saves when my next "true" or "false" comes. DISCONNECTED stage was 1st stage to write to eeprom which is done correctly.
now in the code i have changed this :

void onWebSocketEvent(uint8_t client_num, WStype_t type, uint8_t * payload, size_t length) { // main loop for websocket.
  yield();
  // Figure out the type of WebSocket event
  switch (type) {

    // Client has disconnected
    case WStype_DISCONNECTED:
      Serial.printf("[%u] Disconnected!\n", client_num);
      // newClient.disconnect();
      removeClient(client_num + 1); //remove client if its disconnects.
      printClient();
      Serial.print("client disconnected>> -");
      Serial.println(client_num);

      if (!checkClient()) {
        mainSwitch = "HomeFragment";
        Serial.println(mainSwitch);
        Serial.print("write to EEPROM for this time. ");
        
      }

      break;

here i will save to eeprom if my device gets disconnected but if it stays connected then where will i be able to save it to eeprom by using counter loop or else if possible should it work that way sir?

When i will use slider value comes : "true" all the time, but if i stop moving slider then it will comes "false". so when the false comes my millis() will check if 5 seconds gone or not. as per your code but after 5 seconds it wont save to eeprom

seems like no progress being made

// -----------------------------------------------------------------------------
void
actDisc (void)
{
        actionDisc ()
        Serial.printf("[%u] Disconnected!\n", client_num);
        // newClient.disconnect();
        removeClient(client_num + 1);
        //remove client if its disconnects.
        printClient();
        Serial.print("client disconnected>> -");
        Serial.println(client_num);
        if (!checkClient()) {
            mainSwitch = "HomeFragment";
            Serial.println(mainSwitch);
        }
}

// ----------------------------------------
void
actConn (void)
{
    IPAddress ip = webSocket.remoteIP(client_num);
    Serial.printf("[%u] Connection from ", client_num);
    Serial.println(ip.toString());
    clients_num[addClient()] = client_num + 1;
    printClient();
    // print client if its connected.
    Serial.print("client connected>> -");
    Serial.println(client_num);
    JsonObject jsonObject = doc3.to<JsonObject>();
    JsonObject ServerObject = jsonObject.createNestedObject("ServerValue");
    ServerObject["Bulb"] = ledState;
    ServerObject["Slider1"] = String(cctSlider1);
    ServerObject["Slider2"] = String(cctSlider2);
    ServerObject["ColorSlider"] = colorSlider;
    ServerObject["ColorSlider1"] = String(colorSlider1);
    ServerObject["ColorSlider2"] = String(colorSlider2);
    ServerObject["MainSwitch"] = mainSwitch;
    ServerObject["Sliding"] = isSliding;
    String output;
    serializeJson(doc3, output);
    webSocket.sendTXT(client_num, output);
    //serialize and send initial data to the app. serverobject via Json.
}

// ----------------------------------------
void
actText (void)
{
Serial.printf("[%u] Text: %s\n", client_num, payload);
if (isJSONValid(String((char *)payload))) {
    JsonObject jsonObject = doc.as<JsonObject>();
    if (!jsonObject.isNull() && jsonObject.containsKey("Bulb")) {
        JsonObject bulbObject = jsonObject.getMember("Bulb");
        ledState = (const char*)bulbObject["State"];
        Serial.println("received msg " + ledState + " from " + client_num);
        if (ledState == "OFF")
        {
            analogWrite(pin_dimm, 0);
            // turn off led
        }

        else if (ledState == "ON") {
            analogWrite(pin_dimm, cctSlider1);
            // turn on to slider value.
        }

        sendALL(((char *)payload), "All");
        //session.getId()
    }

    else if (!jsonObject.isNull() && jsonObject.containsKey("Slider1")) {
        JsonObject bulbObject = jsonObject.getMember("Slider1");
        cctSlider1 = bulbObject["Value"].as<int>();
        isSliding = (const char*)bulbObject["Sliding"];
        Serial.println(isSliding + " received msgsld " + cctSlider1 + " from " + client_num);
        old_cct1 = cctSlider1;
        CCTLED_function(cctSlider1);
        
        if (!isSliding.equals("true")) {
            Serial.println("false");
            state = 0;
            msecLastSckt = millis();
            sendALL(((char *)payload), String(client_num + 1));
        }

        else if(!state && millis() - msecLastSckt > 5000) {
            state = 1;
            // write to EEPROM
            Serial.println("EEPROM write operation1");
            delay(500);
        }

        
        
        else {
            Serial.println("true");
            // state = 1;
            // msecLastSckt = millis();
            JsonObject jsonObject = doc2.to<JsonObject>();
            JsonObject ServerObject = jsonObject.createNestedObject("isSliding");
            ServerObject["Sliding"] = "true";
            String output;
            serializeJson(doc2, output);
            Serial.println(" output: " + output);
            //  webSocket.sendTXT(client_num+1, output);
            sendALL((output), String(client_num + 1));
        }
    }
}

// -----------------------------------------------------------------------------
#define SEC5    5000
unsigned long eepromWrMsec  = 0;
int           eepromWrState = 0;

// ----------------------------------------
void
eepromWrReset (void)
{
    eepromWrMsec  = millis();
    eepromWrState = 0;
}

// ----------------------------------------
void
eepromWrCheck (void)
{
    if (millis() > eepromWrMsec + SEC5 && 0 = eepromWrState) {
        eepromWrState = 1;
        // write something to EEPROM
    }
}

// -----------------------------------------------------------------------------
// Called when receiving any WebSocket message
void
onWebSocketEvent(
    uint8_t client_num,
    WStype_t type,
    uint8_t * payload,
    size_t length)
{
    yield();
    // Figure out the type of WebSocket event
    switch (type) {
    // Client has disconnected
    case WStype_DISCONNECTED:
        actDisc ();
        break;

    // New client has connected
    case WStype_CONNECTED:
        actConn ();
        eepromWrReset ();
        break;

    // Echo text message back to client
    case WStype_TEXT:   // main data receive and transmitt via this case.
        actText ();
        eepromWrReset ();
        break;

    default:
        break;
    }
}

// -----------------------------------------------------------------------------
void loop()
{
    webSocket.loop();
    eepromWrCheck ();
}

// ----------------------------------------

Thank you so much sir, I have tried various things but I ended up with worst method, and also will you teach me later these complex programming. :slight_smile:

Sir my ESP-8266-12E crashed:

10:47:34.057 -> [0] Connection from 10.50.1.100
10:47:34.057 -> 
10:47:34.057 ->  afterclients_num[i]= 1 condition= 0
10:47:34.057 ->  afterclients_num[i]= 0 condition= 1
10:47:34.057 ->  afterclients_num[i]= 0 condition= 2
10:47:34.057 ->  afterclients_num[i]= 0 condition= 3
10:47:34.057 ->  afterclients_num[i]= 0 condition= 4client connected>> -0
10:47:34.057 -> 
10:47:34.057 -> Exception (28):
10:47:34.057 -> epc1=0x4020de6e epc2=0x00000000 epc3=0x4022b2bf excvaddr=0x00000000 depc=0x00000000
10:47:34.057 -> 
10:47:34.057 -> >>>stack>>>
10:47:34.057 -> 
10:47:34.057 -> ctx: cont
10:47:34.057 -> sp: 3ffff840 end: 3fffffc0 offset: 01a0
10:47:34.057 -> 3ffff9e0:  3ffffae0 00000000 3ffffa40 4020c5e1  
10:47:34.057 -> 3ffff9f0:  00000001 feefeffe feefeffe 00000008  
10:47:34.057 -> 3ffffa00:  3ffe8304 00000008 3ffffae0 4021044a  
10:47:34.057 -> 3ffffa10:  3ffffa83 3ffe8773 00000000 feefeffe  
10:47:34.091 -> 3ffffa20:  feefeffe feefeffe feefeffe 3ffe877d  
10:47:34.091 -> 3ffffa30:  00000000 3ffe877c 3ffffae0 4021087b  
10:47:34.091 -> 3ffffa40:  00000000 ffffffff 00000000 00000000  
10:47:34.091 -> 3ffffa50:  00000001 0000000a fe302073 feefeffe  
10:47:34.091 -> 3ffffa60:  feefeffe feefeffe feefeffe feefeffe  
10:47:34.091 -> 3ffffa70:  feefeffe feefeffe feefeffe feefeffe  
10:47:34.091 -> 3ffffa80:  0030effe feefeffe feefeffe feefeffe  
10:47:34.125 -> 3ffffa90:  feefeffe feefeffe 00000000 feefeffe  
10:47:34.125 -> 3ffffaa0:  3ffffc10 3ffffbe0 00000010 3ffe8304  
10:47:34.125 -> 3ffffab0:  00000001 00000009 00000001 feefeffe  
10:47:34.125 -> 3ffffac0:  00000005 00000000 00000020 00000001  
10:47:34.125 -> 3ffffad0:  3ffeeedc 3ffe8304 00000040 4020de1d  
10:47:34.125 -> 3ffffae0:  3ffffb9a 00000000 00000035 ffff0208  
10:47:34.125 -> 3ffffaf0:  3ffffb90 0000003f 3ffef83c 00020021  
10:47:34.125 -> 3ffffb00:  4022d6d2 3ffec770 3ffef83c 3ffec770  
10:47:34.158 -> 3ffffb10:  00000005 00000005 00000008 3fff5308  
10:47:34.158 -> 3ffffb20:  3ffe9002 4022c683 3ffec770 00000020  
10:47:34.158 -> 3ffffb30:  00000000 4021fc2f 3fff45bc 3ffef83c  
10:47:34.158 -> 3ffffb40:  00000000 00000002 00000000 3ffec770  
10:47:34.158 -> 3ffffb50:  3fff5322 00000008 3ffeeedc 4020de60  
10:47:34.158 -> 3ffffb60:  3ffffc10 3ffffbe0 00000008 3fffc278  
10:47:34.158 -> 3ffffb70:  00000004 40210aad 3fff4478 3ffef1f8  
10:47:34.192 -> 3ffffb80:  00000004 00000000 0000000a 40206d90  
10:47:34.192 -> 3ffffb90:  205d305b 74786554 0000203a 00000000  
10:47:34.192 -> 3ffffba0:  3ffef66c 3ffef634 3fff52ec 40210d3a  
10:47:34.192 -> 3ffffbb0:  00004000 3ffef634 3fff52ec 40211154  
10:47:34.192 -> 3ffffbc0:  3ffef474 00000000 3ffffd20 4021044a  
10:47:34.192 -> 3ffffbd0:  3ffffc10 3ffffbe0 00000008 3ffef478  
10:47:34.192 -> 3ffffbe0:  007a1200 c364a528 00000000 00000000  
10:47:34.192 -> 3ffffbf0:  3ffee978 00000000 00000001 4010019c  
10:47:34.225 -> 3ffffc00:  3ffe8770 3fff52ec 3ffffbe0 3ffffc10  
10:47:34.225 -> 3ffffc10:  3ffee994 00000000 00000003 00000001  
10:47:34.225 -> 3ffffc20:  3ffee994 3ffee97c 3ffeeedc 40202cc4  
10:47:34.225 -> 3ffffc30:  00000000 00000dc4 3ffffe80 4020751a  
10:47:34.225 -> 3ffffc40:  3fff5330 3fff49d8 3ffef634 4021a2c0  
10:47:34.225 -> 3ffffc50:  3fff49d4 00000000 00000020 40100a04  
10:47:34.225 -> 3ffffc60:  007a1200 c364a25d 00000000 00000000  
10:47:34.259 -> 3ffffc70:  00000000 00000000 00000001 4010019c  
10:47:34.259 -> 3ffffc80:  00000020 00000b61 00000003 00000001  
10:47:34.259 -> 3ffffc90:  3ffee994 00000000 00000003 00000001  
10:47:34.259 -> 3ffffca0:  3ffee994 00000000 00000003 4020354e  
10:47:34.259 -> 3ffffcb0:  3fff4c24 3fff4b9c 3ffee9cc 40209f84  
10:47:34.259 -> 3ffffcc0:  3ffef634 00000000 00000000 4020a2e2  
10:47:34.259 -> 3ffffcd0:  00000000 4bc6a7f0 e0418937 40205c62  
10:47:34.259 -> 3ffffce0:  007a1200 c3649130 4bc6a700 40205740  
10:47:34.292 -> 3ffffcf0:  00000000 00000000 40100294 0007ccd9  
10:47:34.292 -> 3ffffd00:  00000000 00000000 00000000 00000000  
10:47:34.292 -> 3ffffd10:  00000001 3ffee9cc 3ffffd70 4020a2a8  
10:47:34.292 -> 3ffffd20:  00005498 c364253d 3ffee9cc 401000e3  
10:47:34.292 -> 3ffffd30:  3fff4b9c 3ffee9cc 3ffffd70 40205959  
10:47:34.292 -> 3ffffd40:  0007ccd9 0000001d 00000020 40100a04  
10:47:34.292 -> 3ffffd50:  3ffee9cc 3fff52e1 00000010 0000001d  
10:47:34.325 -> 3ffffd60:  3fff4b9c 3ffee994 3ffee9cc 40205b6c  
10:47:34.325 -> 3ffffd70:  3fff46fc c364816d 40205314 4020a284  
10:47:34.325 -> 3ffffd80:  00000000 3fff520c 40100294 0007ccd9  
10:47:34.325 -> 3ffffd90:  00000000 00000000 00000000 00000000  
10:47:34.325 -> 3ffffda0:  00000001 3ffee9cc 3ffffe00 40205bd1  
10:47:34.325 -> 3ffffdb0:  00000001 00000000 000000c7 401000e3  
10:47:34.325 -> 3ffffdc0:  3ffeea35 3ffee9cc 3ffffe00 40205959  
10:47:34.359 -> 3ffffdd0:  0007ccd9 00000004 3fff41b4 3ffee994  
10:47:34.359 -> 3ffffde0:  00000001 00000001 0000000c 00000000  
10:47:34.359 -> 3ffffdf0:  3ffee994 00000006 3ffee9cc 402059d7  
10:47:34.359 -> 3ffffe00:  3fff4754 4bc6a7f0 402052c8 40205bb8  
10:47:34.359 -> 3ffffe10:  3ffeea35 00000004 00000b46 40100744  
10:47:34.359 -> 3ffffe20:  00000000 40201800 40100294 00000000  
10:47:34.359 -> 3ffffe30:  3ffeea35 3ffee994 3ffee9cc 40205b0e  
10:47:34.359 -> 3ffffe40:  007a1200 c3647245 4bc6a700 00000000  
10:47:34.393 -> 3ffffe50:  3fff5134 3ffee994 40100294 0007ccd9  
10:47:34.393 -> 3ffffe60:  00000000 00000000 00000000 00000000  
10:47:34.393 -> 3ffffe70:  00000001 3ffee9cc 3ffffed0 40205bd1  
10:47:34.393 -> 3ffffe80:  3fff5100 00c700cf 80000000 401000e3  
10:47:34.393 -> 3ffffe90:  3ffeea33 3ffee9cc 3ffffed0 40205959  
10:47:34.393 -> 3ffffea0:  0007ccd9 00000002 00000002 3ffee9e0  
10:47:34.393 -> 3ffffeb0:  3ffee9e0 3ffee994 0000000c 00000000  
10:47:34.393 -> 3ffffec0:  3ffee994 00000002 3ffee9cc 402059d7  
10:47:34.426 -> 3ffffed0:  3fff472c 3ffee994 402052c8 40205bb8  
10:47:34.426 -> 3ffffee0:  3ffeea33 00000002 3ffee9cc 402074b0  
10:47:34.426 -> 3ffffef0:  3fff4abc 3ffee994 3ffee9cc 000000cc  
10:47:34.426 -> 3fffff00:  3ffeedc8 3ffee994 3ffee9cc 40205b91  
10:47:34.426 -> 3fffff10:  3fff4600 001e001f 80ff455c 3fff4a00  
10:47:34.426 -> 3fffff20:  00000000 4bc6a7f0 a6666666 00000000  
10:47:34.426 -> 3fffff30:  00000000 00000000 4bc6a7f0 000000cc  
10:47:34.426 -> 3fffff40:  3ffeedc8 3ffee994 3ffee9cc 40205bb1  
10:47:34.459 -> 3fffff50:  007a1200 3ffee994 3ffee9cc 40206875  
10:47:34.459 -> 3fffff60:  007a1200 c3645089 00000000 4010019c  
10:47:34.459 -> 3fffff70:  00000000 00000000 3ffeefcc 3ffef00c  
10:47:34.459 -> 3fffff80:  3fffdad0 00000000 3ffee994 402068c1  
10:47:34.459 -> 3fffff90:  3fffdad0 00000000 3ffeefcc 40201340  
10:47:34.459 -> 3fffffa0:  3fffdad0 00000000 3ffeefcc 402083b8  
10:47:34.459 -> 3fffffb0:  feefeffe feefeffe 3ffe8540 40100c91  
10:47:34.459 -> <<<stack<<<
10:47:34.492 -> 
10:47:34.492 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
10:47:34.492 -> 
10:47:34.492 -> load 0x4010f000, len 1392, room 16 
10:47:34.492 -> tail 0
10:47:34.492 -> chksum 0xd0
10:47:34.492 -> csum 0xd0
10:47:34.492 -> v3d128e5c
10:47:34.492 -> ~ld
10:47:34.562 -> 
10:47:34.562 -> Serial started at 115200
10:47:34.562 -> 
10:47:34.562 -> Connecting to esp8266websocket_1
10:47:34.562 -> 
10:47:34.562 -> [CONNECTED]
10:47:34.562 -> [IP (IP unset)]
10:47:34.562 -> Server started
10:47:39.498 -> write it now!  stage 2

I have used yield(); function but it doesnt work it resets on software watchdog timer . rst cause:2

Here is my exception decoder message:
1st part:

Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x4020de6e: pgm_read_byte_inlined at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/sys/xtensa/sys/pgmspace.h line 72
EXCVADDR: 0x00000000

Decoding stack results
0x4020c5e1: _printf_i at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf_i.c line 226
0x4021044a: __ssputs_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 233
0x4021087b: _svfprintf_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 667
0x4020de1d: _vsnprintf_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/vsnprintf.c line 73
0x4020de60: vsnprintf at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/vsnprintf.c line 42
0x40210aad: glue2esp_linkoutput at glue-esp/lwip-esp.c line 301
0x40206d90: Print::printf(char const*, ...) at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\Print.cpp line 63
0x40210d3a: new_linkoutput at glue-lwip/lwip-git.c line 260
0x40211154: ethernet_output at netif/ethernet.c line 312
0x4021044a: __ssputs_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 233
0x4010019c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
0x40202cc4: actText() at E:\5Channel final code\RGB HUE-SAT-BRIGHTNESS\HUE_sat_bright/HUE_sat_bright.ino line 216
0x4020751a: String::changeBuffer(unsigned int) at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\WString.cpp line 182
0x4021a2c0: ip4_output_if_opt_src at core/ipv4/ip4.c line 1764
0x40100a04: malloc(size_t) at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\umm_malloc\umm_malloc.cpp line 511
0x4010019c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
0x4020354e: onWebSocketEvent(unsigned char, WStype_t, unsigned char*, unsigned int) at E:\5Channel final code\RGB HUE-SAT-BRIGHTNESS\HUE_sat_bright/HUE_sat_bright.ino line 500
0x40209f84: std::_Function_handler ::_M_invoke(std::_Any_data const&, unsigned char, WStype_t, unsigned char*, unsigned int) at c:\users\asus\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2073
0x4020a2e2: WebSocketsServer::runCbEvent(unsigned char, WStype_t, unsigned char*, unsigned int) at C:\Users\Asus\Documents\Arduino\libraries\WebSockets\src/WebSocketsServer.h line 179
0x40205c62: WebSocketsServer::messageReceived(WSclient_t*, WSopcode_t, unsigned char*, unsigned int, bool) at C:\Users\Asus\Documents\Arduino\libraries\WebSockets\src\WebSocketsServer.cpp line 526
0x40205740: WebSockets::handleWebsocketPayloadCb(WSclient_t*, bool, unsigned char*) at C:\Users\Asus\Documents\Arduino\libraries\WebSockets\src\WebSockets.cpp line 484
0x40100294: millis() at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_wiring.cpp line 188
0x4020a2a8: std::_Function_handler    (WebSockets*, std::_Placeholder1>, std::_Placeholder2>, unsigned char*)> >::_M_invoke(std::_Any_data const&, WSclient_t*, bool) at c:\users\asus\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2073
0x401000e3: std::function ::operator()(WSclient_t*, bool) const at c:\users\asus\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2465
0x40205959: WebSockets::readCb(WSclient_t*, unsigned char*, unsigned int, std::function ) at C:\Users\Asus\Documents\Arduino\libraries\WebSockets\src\WebSockets.cpp line 650
0x40100a04: malloc(size_t) at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\umm_malloc\umm_malloc.cpp line 511
0x40205b6c: WebSockets::handleWebsocketCb(WSclient_t*) at c:\users\asus\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2174