esp32_https_server icon indicating copy to clipboard operation
esp32_https_server copied to clipboard

How to get the client connection status?

Open fustyles opened this issue 3 years ago • 0 comments

I would like to get the client connection status. What should I do it?

void handleRoot(HTTPRequest * req, HTTPResponse * res) {
  String head = "--Hello\r\nContent-Type: image/jpeg\r\n\r\n";
  String tail = "\r\n--Hello--\r\n";
              
  res->setHeader("Access-Control-Allow-Origin", "*");
  res->setHeader("Content-Type", "multipart/x-mixed-replace; boundary=Hello");
  
  while  ( **client.connected()** ) {   //If the connection is closed, then stop responding.

    //etc...

    res->print("\r\n");
  }     
}

fustyles avatar Nov 12 '22 13:11 fustyles