From a9c11e10bed42880d2d90d67afd09ac68fe8c00d Mon Sep 17 00:00:00 2001 From: Philipp Hasper Date: Thu, 5 Nov 2015 11:26:33 +0100 Subject: [PATCH] Adding removeWebSocketHandler --- include/CivetServer.h | 9 +++++++++ src/CivetServer.cpp | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/include/CivetServer.h b/include/CivetServer.h index 05637126..aacab683 100644 --- a/include/CivetServer.h +++ b/include/CivetServer.h @@ -243,6 +243,15 @@ class CIVETWEB_API CivetServer */ void removeHandler(const std::string &uri); + /** + * removeWebSocketHandler(const std::string &) + * + * Removes a web socket handler. + * + * @param uri - the exact URL used in addWebSocketHandler(). + */ + void removeWebSocketHandler(const std::string &uri); + /** * getListeningPorts() * diff --git a/src/CivetServer.cpp b/src/CivetServer.cpp index 98ba6002..56f8dd8c 100644 --- a/src/CivetServer.cpp +++ b/src/CivetServer.cpp @@ -285,6 +285,12 @@ void CivetServer::removeHandler(const std::string &uri) { mg_set_request_handler(context, uri.c_str(), NULL, NULL); +} + +void +CivetServer::removeWebSocketHandler(const std::string &uri) +{ + mg_set_websocket_handler(context, uri.c_str(), NULL, NULL, NULL, NULL, NULL); } void