ソースを参照

Add support for retained messages in test client

Christopher Mullins 6 年 前
コミット
e51d19bb38
共有1 個のファイルを変更した4 個の追加2 個の削除を含む
  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
   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
   end
 
 
   def patch_state(id_params, state = {})
   def patch_state(id_params, state = {})