title: NodeMCU (ESP8266) Exception 28 when a client disconnect
body: <p>I have a websocket server on nodemcu v3(ESP8266) and a websocket client made in Qt. When a client disconnect, the server give exception 28 and i dont know why. </p>
  
  <p>Here is the stack decoded with ESP Exception Decoder. </p>
  
  <pre><code>ecoding stack results
  0x4020b7f8: __ssputs_r at ../../../.././newlib/libc/stdio/nano-vfprintf.c     line 180
  0x4020b7f8: __ssputs_r at ../../../.././newlib/libc/stdio/nano-vfprintf.c     line 180
  0x40207851: _printf_common at ../../../.././newlib/libc/stdio/nano-    vfprintf_i.c line 94
  0x4020b7f8: __ssputs_r at ../../../.././newlib/libc/stdio/nano-vfprintf.c     line 180
  0x40207c0c: _printf_i at ../../../.././newlib/libc/stdio/nano-    vfprintf_i.c line 241
  0x4020baa0: _svfprintf_r at ../../../.././newlib/libc/stdio/nano-    vfprintf.c line 531
  0x4020d151: glue2esp_linkoutput at glue-esp/lwip-esp.c line 299
  0x4020bc58: _svfprintf_r at ../../../.././newlib/libc/stdio/nano-    vfprintf.c line 641
  0x4020d4a6: new_linkoutput at glue-lwip/lwip-git.c line 259
  0x40213a64: etharp_output_LWIP2 at core/ipv4/etharp.c line 882
  0x4020453c: WebSockets::handleWebsocketWaitFor(WSclient_t*, unsigned int)     at C:\Users\aurel\OneDrive\Documents\Arduino\libraries\arduinoWebSockets-    master\src\WebSockets.cpp line 296
  0x40209639: _vsnprintf_r at ../../../.././newlib/libc/stdio/vsnprintf.c     line 73
  0x40209639: _vsnprintf_r at ../../../.././newlib/libc/stdio/vsnprintf.c     line 73
  0x4020967c: vsnprintf at ../../../.././newlib/libc/stdio/vsnprintf.c line     42
  0x40205a68: Print::printf(char const*, ...) at C:\Users\aurel\AppData    \Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266    \Print.cpp line 63
  0x402028d0: webSocketEvent(unsigned char, WStype_t, unsigned char*,     unsigned int) at D:\Workspace\Arduino\arduino-health-care-system\Arduino    \WebSocketServerApp/WebSocketServerApp.ino line 69
  0x402028fc: webSocketEvent(unsigned char, WStype_t, unsigned char*,     unsigned int) at D:\Workspace\Arduino\arduino-health-care-system\Arduino    \WebSocketServerApp/WebSocketServerApp.ino line 71
  0x4010020c: _umm_free at C:\Users\aurel\AppData\Local\Arduino15\packages    \esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc\umm_malloc.c line     1295
  0x401006dc: free at C:\Users\aurel\AppData\Local\Arduino15\packages    \esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc\umm_malloc.c line     1755
  0x4010020c: _umm_free at C:\Users\aurel\AppData\Local\Arduino15\packages    \esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc\umm_malloc.c line     1295
  0x402068a4: std::_Function_handler ::_M_invoke(std::_Any_data const&amp;,     unsigned char, WStype_t, unsigned char*, unsigned int) at c:\users\aurel    \appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-    gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional line     2073
  0x40206b04: WebSocketsServer::runCbEvent(unsigned char, WStype_t,     unsigned char*, unsigned int) at C:\Users\aurel\OneDrive\Documents\Arduino    \libraries\arduinoWebSockets-master\src/WebSocketsServer.h line 182
  0x402048c6: WebSocketsServer::clientDisconnect(WSclient_t*) at C:\Users    \aurel\OneDrive\Documents\Arduino\libraries\arduinoWebSockets-master    \src\WebSocketsServer.cpp line 585
  0x40206b41: WebSocketsServer::clientIsConnected(WSclient_t*) at C:\Users    \aurel\OneDrive\Documents\Arduino\libraries\arduinoWebSockets-master    \src\WebSocketsServer.cpp line 611
  0x40205371: WebSocketsServer::handleClientData() at C:\Users\aurel    \OneDrive\Documents\Arduino\libraries\arduinoWebSockets-master    \src\WebSocketsServer.cpp line 671
  0x402053fd: WebSocketsServer::loop() at C:\Users\aurel\OneDrive\Documents    \Arduino\libraries\arduinoWebSockets-master\src\WebSocketsServer.cpp line 135
  0x40202b14: loop() at D:\Workspace\Arduino\arduino-health-care-system    \Arduino\WebSocketServerApp/WebSocketServerApp.ino line 58
  0x402065d1: esp_schedule() at C:\Users\aurel\AppData\Local\Arduino15    \packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_main.cpp     line 95
  0x4020663c: loop_wrapper() at C:\Users\aurel\AppData\Local\Arduino15    \packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_main.cpp     line 125
  </code></pre>
  
  <p>Here is the code on the nodemcu.A simple websocket server which receives data from serial and send it to the client.</p>
  
  <pre><code>#include &lt;ESP8266WiFi.h&gt;
  #include &lt;WiFiClient.h&gt;
  #include &lt;ESP8266WebServer.h&gt;
  #include &lt;WebSocketsServer.h&gt;
  #include &lt;Hash.h&gt;
  #include &lt;SoftwareSerial.h&gt;
  
  SoftwareSerial s(D6,D5);
  String data;
  int ledPin = D7;
  
  const char* ssid = "blablabla";
  const char* password = "blablabla";
  
  
  WebSocketsServer webSocket = WebSocketsServer(81);
  
  void setup() {
    Serial.begin(9600);
    s.begin(9600);
    WiFi.setAutoReconnect(true);
    WiFi.begin(ssid, password);
    Serial.println("");
  
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
     }
  
      Serial.println("");
      Serial.print("Connected to ");
      Serial.println(ssid);
      Serial.print("IP address: ");
      Serial.println(WiFi.localIP());
  
      webSocket.begin();
      webSocket.onEvent(webSocketEvent);
  
      pinMode(ledPin, OUTPUT);    
  }
  
  void loop() {
  
        if (WiFi.status() == WL_CONNECTED) {
            digitalWrite(ledPin, HIGH);        
        } else {
            digitalWrite(ledPin, LOW);
        }
  
      webSocket.loop();
  
  
      if (s.available()&gt;0)
      {
        data=s.readString();
  
        webSocket.broadcastTXT(data); 
        Serial.println(data);  
     }
  
  
  }
  
  void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t     length){
  
  
     if (type == WStype_TEXT){
      for(int i = 0; i &lt; length; i++) {
        Serial.print((char) payload[i]);
  
     }
      s.print(String((char *)payload));
      Serial.println();     
     }
  }
  </code></pre>