node-red/packages/node_modules/@node-red/nodes/locales/zh-CN/network/10-mqtt.html

72 lines
4.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="mqtt in">
<p>连接到MQTT代理并订阅来自指定主题的消息</p>
<h3>输出</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">字符串 | buffer</span></dt>
<dd>如果不是二进制buffer的话就是字符串</dd>
<dt>topic <span class="property-type">字符串</span></dt>
<dd>MQTT主题使用<code>/</code></dd>
<dt>qos <span class="property-type">数值</span> </dt>
<dd>QoS服务质量0, 最多一次 1, 最少一次 2, 只一次</dd>
<dt>retain <span class="property-type">布尔值</span></dt>
<dd>值为true时表示消息已保留且可能是旧的</dd>
</dl>
<h3>详细</h3>
<p>订阅主题可以包括MQTT通配符+一个级别多个级别</p>
<p>使用该节点您首先需要建立与MQTT代理的连接通过单击铅笔图标来进行配置</p>
<p>如有需要几个MQTT节点输入或输出可以共享相同的代理连接</p>
</script>
<script type="text/x-red" data-help-name="mqtt out">
<p>连接到MQTT代理并发布消息</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">字符串 | buffer</span></dt>
<dd>要发布的有效负载如果未设置此属性则不会发送任何消息要发送空白消息请将此属性设置为空字符串</dd>
<dt class="optional">topic <span class="property-type">字符串</span></dt>
<dd>要发布的MQTT主题</dd>
<dt class="optional">qos <span class="property-type">number</span></dt>
<dd>QoS服务质量0, 最多一次 1, 最少一次 2, 只一次默认值为0</dd>
<dt class="optional">retain <span class="property-type">布尔值</span></dt>
<dd>设置为<code>true</code><code>false</code></dd>
</dl>
<h3>详细</h3>
<p><code>msg.payload</code>ObjectJSONbuffer</p>
<p>可以在节点中配置所使用的主题或者如果留为空白则可以通过<code>msg.topic</code></p>
<p>同样可以在节点中配置QoS和保留值或者如果保留空白则分别由<code>msg.qos</code><code>msg.retain</code></p>
<p>该节点需要与要配置的MQTT代理的连接通过单击铅笔图标进行配置</p>
<p>如果需要几个MQTT节点输入或输出可以共享相同的代理连接</p>
</script>
<script type="text/x-red" data-help-name="mqtt-broker">
<p>与MQTT代理的连接设置</p>
<p>创建与代理的连接设置可以在<code>MQTT In</code><code>MQTT Out</code></p>
<p>如果未为该节点设置客户端ID并且设置了会话初始化则将生成一个随机客户端ID设置客户端ID时请确保它对于连接目标处的代理是唯一的</p>
<h4>Birth Message</h4>
<p>建立连接后发布在以配置主题中的消息</p>
<h4>Close Message</h4>
<p>在连接正常结束之前重新部署或者关闭了节点时发布在以配置主题中的消息</p>
<h4>Will Message</h4>
<p>当节点意外丢失连接时由代理发布的消息</p>
<h4>WebSockets</h4>
<p>可以将节点配置成使用WebSocket连接使用WebSocket时请在服务器字段中以完整格式描述连接目标的URI 例如</p>
<pre>ws://example.com:4000/mqtt</pre>
</script>