Skip to content

Commit

Permalink
✨ 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
li-xunhuan committed Nov 22, 2023
1 parent f41f1f1 commit 71485e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mqtt:
ip: 127.0.0.1 # 连接的服务端 ip ,默认:127.0.0.1
port: 1883 # 端口:默认:1883
name: Mica-Mqtt-Client # 名称,默认:Mica-Mqtt-Client
clientId: 000001 # 客户端Id(非常重要,一般为设备 sn,不可重复)
clientId: "000001" # 客户端Id(非常重要,一般为设备 sn,不可重复)
user-name: mica # 认证的用户名
password: 123456 # 认证的密码
timeout: 5 # 超时时间,单位:秒,默认:5秒
Expand All @@ -22,6 +22,10 @@ mqtt:
buffer-allocator: heap # 堆内存和堆外内存,默认:堆内存
keep-alive-secs: 60 # keep-alive 时间,单位:秒
clean-session: true # mqtt clean session,默认:true
will-message:

topic: /test/offline
message: down
ssl:
enabled: false # 是否开启 ssl 认证,2.1.0 开始支持双向认证
keystore-path: # 可选参数:ssl 双向认证 keystore 目录,支持 classpath:/ 路径。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void onBeforeClose(ChannelContext context, Throwable throwable, String re
cleanSession(clientId);
context.remove(MqttConst.DIS_CONNECTED);
// 7. 下线事件
String username = (String) context.get(MqttConst.USER_NAME_KEY);
String username = context.get(MqttConst.USER_NAME_KEY);
context.remove(MqttConst.USER_NAME_KEY);
notify(context, clientId, username, remark);
}
Expand Down

0 comments on commit 71485e9

Please sign in to comment.