eclipse / paho.mqtt.m2mqtt

Eclipse Public License 1.0
512 stars 303 forks source link

Possibility to add Handler to specific topics (Filter by topic) #116

Open NichtEuler opened 4 years ago

NichtEuler commented 4 years ago

Hi,

ist there a possibility to add an eventhandler to a specific topic, like in System.Net.Mqtt: mqttClient.MessageStream.Where(msg => msg.Topic == "home/lights/kitchen").Subscribe(kitchen);

 private void kitchen(MqttApplicationMessage obj)
        {
                lightSwitch.Text = "Lights are: " + ByteArrayToString(obj.Payload);
        }

So you dont have to filter by topic in the eventhandler you've added to client.MqttMsgPublishReceived?