Explorar el Código

Add support for retained messages in test client

Christopher Mullins hace 6 años
padre
commit
e51d19bb38
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  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 = {})