mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2026-01-29 09:40:10 +01:00
Allow callback when request disconnects (#284)
* Allow callback when request disconnects * Use typedef std::function<void(void)> ArDisconnectHandler
This commit is contained in:
@@ -214,8 +214,15 @@ void AsyncWebServerRequest::_onTimeout(uint32_t time){
|
||||
_client->close();
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::onDisconnect (ArDisconnectHandler fn){
|
||||
_onDisconnectfn=fn;
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::_onDisconnect(){
|
||||
//os_printf("d\n");
|
||||
if(_onDisconnectfn) {
|
||||
_onDisconnectfn();
|
||||
}
|
||||
_server->_handleDisconnect(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user