Pārlūkot izejas kodu

Add support for retained messages in test client

Christopher Mullins 6 gadi atpakaļ
vecāks
revīzija
e51d19bb38
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      test/remote/lib/mqtt_client.rb

+ 4 - 2
test/remote/lib/mqtt_client.rb

@@ -87,8 +87,10 @@ class MqttClient
     end
   end
 
-  def publish(topic, state = {})
-    @client.publish(topic, state.to_json)
+  def publish(topic, state = {}, retain = false)
+    state = state.to_json unless state.is_a?(String)
+
+    @client.publish(topic, state, retain)
   end
 
   def patch_state(id_params, state = {})