Add WebSocket::unsubscribeAll
This commit is contained in:
@@ -198,6 +198,17 @@ public:
|
|||||||
return webSocketContextData->topicTree.unsubscribe(topic, webSocketData->subscriber);
|
return webSocketContextData->topicTree.unsubscribe(topic, webSocketData->subscriber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unsubscribe from all topics you might be subscribed to */
|
||||||
|
void unsubscribeAll() {
|
||||||
|
WebSocketContextData<SSL> *webSocketContextData = (WebSocketContextData<SSL> *) us_socket_context_ext(SSL,
|
||||||
|
(us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
|
||||||
|
);
|
||||||
|
|
||||||
|
WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
|
||||||
|
|
||||||
|
webSocketContextData->topicTree.unsubscribeAll(webSocketData->subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
/* Publish a message to a topic according to MQTT rules and syntax */
|
/* Publish a message to a topic according to MQTT rules and syntax */
|
||||||
void publish(std::string_view topic, std::string_view message, OpCode opCode = OpCode::TEXT, bool compress = false) {
|
void publish(std::string_view topic, std::string_view message, OpCode opCode = OpCode::TEXT, bool compress = false) {
|
||||||
WebSocketContextData<SSL> *webSocketContextData = (WebSocketContextData<SSL> *) us_socket_context_ext(SSL,
|
WebSocketContextData<SSL> *webSocketContextData = (WebSocketContextData<SSL> *) us_socket_context_ext(SSL,
|
||||||
|
|||||||
Reference in New Issue
Block a user