点击或拖拽改变大小

MqttConnectionOptions 属性

MqttConnectionOptions 类型公开以下成员。

属性
  名称说明
公共属性CleanSession
是否清理会话,如果清理会话(CleanSession)标志被设置为1,客户端和服务端必须丢弃之前的任何会话并开始一个新的会话。 会话仅持续和网络连接同样长的时间。与这个会话关联的状态数据不能被任何之后的会话重用 [MQTT-3.1.2-6]。默认为清理会话。
Whether to clean the session. If the CleanSession flag is set to 1, the client and server must discard any previous session and start a new session. The session only lasts as long as the network connection. The state data associated with this session cannot be reused by any subsequent sessions [MQTT-3.1.2-6]. The default is to clean up the session.
公共属性ClientId
客户端的id的标识
ID of the client
公共属性ConnectTimeout
连接到服务器的超时时间,默认是5秒,单位是毫秒
The timeout period for connecting to the server, the default is 5 seconds, the unit is milliseconds
公共属性Credentials
登录服务器的凭证,包含用户名和密码,可以为空
The credentials for logging in to the server, including the username and password, can be null
公共属性IpAddress
Mqtt服务器的ip地址
IP address of Mqtt server
公共属性KeepAlivePeriod
设置的参数,最小单位为1s,当超过设置的时间间隔没有发送数据的时候,必须发送PINGREQ报文,否则服务器认定为掉线。
The minimum unit of the set parameter is 1s. When no data is sent beyond the set time interval, the PINGREQ message must be sent, otherwise the server considers it to be offline.
公共属性KeepAliveSendInterval
获取或是设置心跳时间的发送间隔。默认30秒钟
Get or set the heartbeat time interval. 30 seconds by default
公共属性Port
端口号。默认1883
The port number. Default 1883
公共属性UseRSAProvider
获取或设置当前的连接是否加密处理,防止第三方对注册报文进行抓包处理,从而分析出用户名和密码,只适用于基于HslCommunication创建的MQTT Server。
Get or set whether the current connection is encrypted or not, to prevent the third party from capturing the registration message, so as to analyze the user name and password. It is only applicable to the MQTT Server created based on HslCommunication.
公共属性WillMessage
遗嘱消息,为空或是主题为空则表示不使用遗嘱,该遗嘱对于 MqttSyncClient 无效
Top
参见