Properly unsubscribe from everywhere on close

This commit is contained in:
Alex Hultman
2019-02-09 09:29:29 +01:00
parent 6fe717f46a
commit 3fe7964e74
3 changed files with 37 additions and 6 deletions
+4
View File
@@ -21,6 +21,7 @@
#include "WebSocketData.h"
#include "WebSocketProtocol.h"
#include "AsyncSocket.h"
#include "WebSocketContextData.h"
#include <string_view>
@@ -124,6 +125,9 @@ public:
if (webSocketContextData->closeHandler) {
webSocketContextData->closeHandler(this, code, message);
}
/* Make sure to unsubscribe from any pub/sub node at exit */
webSocketContextData->topicTree.unsubscribeAll(this);
}
/* Subscribe to a topic according to MQTT rules and syntax */