Pārlūkot izejas kodu

Adding removeWebSocketHandler

Philipp Hasper 9 gadi atpakaļ
vecāks
revīzija
a9c11e10be
2 mainītis faili ar 15 papildinājumiem un 0 dzēšanām
  1. 9 0
      include/CivetServer.h
  2. 6 0
      src/CivetServer.cpp

+ 9 - 0
include/CivetServer.h

@@ -243,6 +243,15 @@ class CIVETWEB_API CivetServer
 	 */
 	 */
 	void removeHandler(const std::string &uri);
 	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()
 	 * getListeningPorts()
 	 *
 	 *

+ 6 - 0
src/CivetServer.cpp

@@ -285,6 +285,12 @@ void
 CivetServer::removeHandler(const std::string &uri)
 CivetServer::removeHandler(const std::string &uri)
 {
 {
 	mg_set_request_handler(context, uri.c_str(), NULL, NULL);
 	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
 void