Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mica
mica-mqtt
提交
2e825615
mica-mqtt
项目概览
mica
/
mica-mqtt
通知
71
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
mica-mqtt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2e825615
编写于
9月 17, 2020
作者:
如梦技术
🐛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
简化客户端使用。
上级
e567f948
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
406 addition
and
60 deletion
+406
-60
README.md
README.md
+3
-1
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClient.java
...ain/java/net/dreamlu/iot/mqtt/core/client/MqttClient.java
+103
-23
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientAioListener.java
...t/dreamlu/iot/mqtt/core/client/MqttClientAioListener.java
+2
-2
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientCreator.java
...a/net/dreamlu/iot/mqtt/core/client/MqttClientCreator.java
+251
-0
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/common/MqttMessageListener.java
...net/dreamlu/iot/mqtt/core/common/MqttMessageListener.java
+37
-0
mica-mqtt-example/src/main/java/net/dreamlu/iot/mqtt/client/MqttClientTest.java
...main/java/net/dreamlu/iot/mqtt/client/MqttClientTest.java
+9
-33
mica-mqtt-example/src/main/java/net/dreamlu/iot/mqtt/server/MqttServerTest.java
...main/java/net/dreamlu/iot/mqtt/server/MqttServerTest.java
+1
-1
未找到文件。
README.md
浏览文件 @
2e825615
...
@@ -11,10 +11,12 @@
...
@@ -11,10 +11,12 @@
-
继续抽象,方便使用。
-
继续抽象,方便使用。
-
实现
`mqtt-broker`
功能。
-
实现
`mqtt-broker`
功能。
## 参考
## 参考
vs借鉴
-
[
netty codec-mqtt
](
https://github.com/netty/netty/tree/4.1/codec-mqtt
)
-
[
netty codec-mqtt
](
https://github.com/netty/netty/tree/4.1/codec-mqtt
)
-
[
jmqtt
](
https://github.com/Cicizz/jmqtt
)
-
[
iot-mqtt-server
](
https://gitee.com/recallcode/iot-mqtt-server
)
-
[
iot-mqtt-server
](
https://gitee.com/recallcode/iot-mqtt-server
)
-
[
moquette
](
https://github.com/moquette-io/moquette
)
-
[
moquette
](
https://github.com/moquette-io/moquette
)
-
[
netty-mqtt-client
](
https://github.com/jetlinks/netty-mqtt-client
)
## 工具
## 工具
-
[
mqttx 优雅的跨平台 MQTT 5.0 客户端工具
](
https://mqttx.app/cn/
)
-
[
mqttx 优雅的跨平台 MQTT 5.0 客户端工具
](
https://mqttx.app/cn/
)
...
...
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClient.java
浏览文件 @
2e825615
...
@@ -16,27 +16,116 @@
...
@@ -16,27 +16,116 @@
package
net.dreamlu.iot.mqtt.core.client
;
package
net.dreamlu.iot.mqtt.core.client
;
import
net.dreamlu.iot.mqtt.codec.MqttMessage
;
import
net.dreamlu.iot.mqtt.codec.*
;
import
net.dreamlu.iot.mqtt.core.common.MqttMessageListener
;
import
org.tio.client.ClientChannelContext
;
import
org.tio.client.ClientChannelContext
;
import
org.tio.client.TioClient
;
import
org.tio.client.TioClient
;
import
org.tio.core.Tio
;
import
org.tio.core.Tio
;
import
java.nio.ByteBuffer
;
/**
/**
* mqtt 客户端
* mqtt 客户端
*
*
* @author L.cm
* @author L.cm
*/
*/
public
class
MqttClient
{
public
final
class
MqttClient
{
private
final
TioClient
tioClient
;
private
final
MqttClientCreator
config
;
private
final
ClientChannelContext
context
;
private
MqttClientConfig
clientConfig
;
public
static
MqttClientCreator
create
()
{
private
MqttClientProcessor
processor
;
return
new
MqttClientCreator
();
private
TioClient
tioClient
;
}
private
ClientChannelContext
clientContext
;
// TODO add subscribe
MqttClient
(
TioClient
tioClient
,
MqttClientCreator
config
,
ClientChannelContext
context
)
{
this
.
tioClient
=
tioClient
;
this
.
config
=
config
;
this
.
context
=
context
;
}
public
void
connect
()
{
/**
* 订阅
*
* @param topicFilter topicFilter
* @param listener MqttMessageListener
* @return MqttClient
*/
public
MqttClient
subscribe
(
String
topicFilter
,
MqttMessageListener
listener
)
{
return
this
;
}
/**
* 订阅
*
* @param topicFilter topicFilter
* @param qos MqttQoS
* @param listener MqttMessageListener
* @return MqttClient
*/
public
MqttClient
subscribe
(
String
topicFilter
,
MqttQoS
qos
,
MqttMessageListener
listener
)
{
return
this
;
}
/**
* 取消订阅
*
* @param topicFilter topicFilter
* @return MqttClient
*/
public
MqttClient
unSubscribe
(
String
topicFilter
)
{
return
this
;
}
/**
* 发布消息
*
* @param topic topic
* @param payload 消息体
* @return 是否发送成功
*/
public
Boolean
publish
(
String
topic
,
ByteBuffer
payload
)
{
return
publish
(
topic
,
payload
,
MqttQoS
.
AT_MOST_ONCE
);
}
/**
* 发布消息
*
* @param topic topic
* @param payload 消息体
* @param qos MqttQoS
* @return 是否发送成功
*/
public
Boolean
publish
(
String
topic
,
ByteBuffer
payload
,
MqttQoS
qos
)
{
return
publish
(
topic
,
payload
,
qos
,
false
);
}
/**
* 发布消息
*
* @param topic topic
* @param payload 消息体
* @param retain 是否在服务器上保留消息
* @return 是否发送成功
*/
public
Boolean
publish
(
String
topic
,
ByteBuffer
payload
,
boolean
retain
)
{
return
publish
(
topic
,
payload
,
MqttQoS
.
AT_MOST_ONCE
,
retain
);
}
/**
* 发布消息
*
* @param topic topic
* @param payload 消息体
* @param qos MqttQoS
* @param retain 是否在服务器上保留消息
* @return 是否发送成功
*/
public
Boolean
publish
(
String
topic
,
ByteBuffer
payload
,
MqttQoS
qos
,
boolean
retain
)
{
MqttPublishMessage
message
=
(
MqttPublishMessage
)
MqttMessageFactory
.
newMessage
(
new
MqttFixedHeader
(
MqttMessageType
.
PUBLISH
,
false
,
qos
,
retain
,
0
),
new
MqttPublishVariableHeader
(
topic
,
0
),
payload
);
return
Tio
.
send
(
context
,
message
);
}
}
/**
/**
...
@@ -44,17 +133,16 @@ public class MqttClient {
...
@@ -44,17 +133,16 @@ public class MqttClient {
*
*
* @throws Exception 异常
* @throws Exception 异常
*/
*/
public
void
reconnect
()
throws
Exception
{
public
MqttClient
reconnect
()
throws
Exception
{
checkState
(
);
tioClient
.
reconnect
(
context
,
config
.
getTimeout
()
);
tioClient
.
reconnect
(
clientContext
,
clientConfig
.
getTimeout
())
;
return
this
;
}
}
/**
/**
* 断开 mqtt 连接
* 断开 mqtt 连接
*/
*/
public
void
disconnect
()
{
public
void
disconnect
()
{
checkState
();
Tio
.
send
(
context
,
MqttMessage
.
DISCONNECT
);
Tio
.
send
(
clientContext
,
MqttMessage
.
DISCONNECT
);
}
}
/**
/**
...
@@ -63,19 +151,11 @@ public class MqttClient {
...
@@ -63,19 +151,11 @@ public class MqttClient {
* @return 是否停止成功
* @return 是否停止成功
*/
*/
public
boolean
stop
()
{
public
boolean
stop
()
{
checkState
();
return
tioClient
.
stop
();
return
tioClient
.
stop
();
}
}
public
ClientChannelContext
getClientContext
()
{
public
ClientChannelContext
getContext
()
{
checkState
();
return
context
;
return
clientContext
;
}
private
void
checkState
()
{
if
(
clientContext
==
null
)
{
throw
new
IllegalStateException
(
"您需要先 connect。"
);
}
}
}
}
}
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientAioListener.java
浏览文件 @
2e825615
...
@@ -31,10 +31,10 @@ import java.util.Objects;
...
@@ -31,10 +31,10 @@ import java.util.Objects;
* @author L.cm
* @author L.cm
*/
*/
public
class
MqttClientAioListener
extends
DefaultClientAioListener
{
public
class
MqttClientAioListener
extends
DefaultClientAioListener
{
private
final
MqttClientC
onfig
clientConfig
;
private
final
MqttClientC
reator
clientConfig
;
private
final
MqttWillMessage
willMessage
;
private
final
MqttWillMessage
willMessage
;
public
MqttClientAioListener
(
MqttClientC
onfig
clientConfig
)
{
public
MqttClientAioListener
(
MqttClientC
reator
clientConfig
)
{
this
.
clientConfig
=
Objects
.
requireNonNull
(
clientConfig
);
this
.
clientConfig
=
Objects
.
requireNonNull
(
clientConfig
);
this
.
willMessage
=
clientConfig
.
getWillMessage
();
this
.
willMessage
=
clientConfig
.
getWillMessage
();
}
}
...
...
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientC
onfig
.java
→
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientC
reator
.java
浏览文件 @
2e825615
...
@@ -17,23 +17,33 @@
...
@@ -17,23 +17,33 @@
package
net.dreamlu.iot.mqtt.core.client
;
package
net.dreamlu.iot.mqtt.core.client
;
import
net.dreamlu.iot.mqtt.codec.MqttVersion
;
import
net.dreamlu.iot.mqtt.codec.MqttVersion
;
import
org.tio.client.ClientChannelContext
;
import
org.tio.client.ClientTioConfig
;
import
org.tio.client.ReconnConf
;
import
org.tio.client.TioClient
;
import
org.tio.client.intf.ClientAioHandler
;
import
org.tio.client.intf.ClientAioListener
;
import
org.tio.core.Node
;
import
org.tio.core.ssl.SslConfig
;
import
org.tio.core.ssl.SslConfig
;
import
java.util.Objects
;
import
java.util.function.Consumer
;
/**
/**
*
MqttClient 配置
*
mqtt 客户端构造器
*
*
* @author L.cm
* @author L.cm
*/
*/
public
class
MqttClientConfig
{
public
final
class
MqttClientCreator
{
/**
/**
* ip,可为空,为空 t-io 默认为 127.0.0.1
* ip,可为空,为空 t-io 默认为 127.0.0.1
*/
*/
private
String
ip
;
private
String
ip
;
/**
/**
* 端口
* 端口
,默认:1883
*/
*/
private
int
port
;
private
int
port
=
1883
;
/**
/**
* 超时时间,t-io 配置,可为 null
* 超时时间,t-io 配置,可为 null
*/
*/
...
@@ -82,108 +92,160 @@ public class MqttClientConfig {
...
@@ -82,108 +92,160 @@ public class MqttClientConfig {
* 遗嘱消息
* 遗嘱消息
*/
*/
private
MqttWillMessage
willMessage
;
private
MqttWillMessage
willMessage
;
/**
* 客户端处理器
*/
private
MqttClientProcessor
processor
;
p
ublic
String
getIp
()
{
p
rotected
String
getIp
()
{
return
ip
;
return
ip
;
}
}
p
ublic
void
setIp
(
String
ip
)
{
p
rotected
int
getPort
(
)
{
this
.
ip
=
ip
;
return
port
;
}
}
p
ublic
int
getPor
t
()
{
p
rotected
Integer
getTimeou
t
()
{
return
por
t
;
return
timeou
t
;
}
}
p
ublic
void
setPort
(
int
port
)
{
p
rotected
int
getKeepAliveSecs
(
)
{
this
.
port
=
port
;
return
keepAliveSecs
;
}
}
p
ublic
Integer
getTimeout
()
{
p
rotected
SslConfig
getSslConfig
()
{
return
timeout
;
return
sslConfig
;
}
}
p
ublic
void
setTimeout
(
Integer
timeout
)
{
p
rotected
boolean
isReconnect
(
)
{
this
.
timeout
=
timeou
t
;
return
reconnec
t
;
}
}
p
ublic
Integer
getKeepAliveSecs
()
{
p
rotected
Long
getReInterval
()
{
return
keepAliveSecs
;
return
reInterval
;
}
}
public
void
setKeepAliveSecs
(
Integer
keepAliveSecs
)
{
public
String
getClientId
(
)
{
this
.
keepAliveSecs
=
keepAliveSecs
;
return
clientId
;
}
}
p
ublic
SslConfig
getSslConfig
()
{
p
rotected
MqttVersion
getProtocolVersion
()
{
return
sslConfig
;
return
protocolVersion
;
}
}
p
ublic
void
setSslConfig
(
SslConfig
sslConfig
)
{
p
rotected
String
getUsername
(
)
{
this
.
sslConfig
=
sslConfig
;
return
username
;
}
}
p
ublic
boolean
isReconnect
()
{
p
rotected
String
getPassword
()
{
return
reconnect
;
return
password
;
}
}
p
ublic
void
setReconnect
(
boolean
reconnect
)
{
p
rotected
boolean
isCleanSession
(
)
{
this
.
reconnect
=
reconnect
;
return
cleanSession
;
}
}
p
ublic
Long
getReInterval
()
{
p
rotected
MqttWillMessage
getWillMessage
()
{
return
reInterval
;
return
willMessage
;
}
}
p
ublic
void
setReInterval
(
Long
reInterval
)
{
p
rotected
MqttClientProcessor
getProcessor
(
)
{
this
.
reInterval
=
reInterval
;
return
processor
;
}
}
public
String
getClientId
()
{
public
MqttClientCreator
ip
(
String
ip
)
{
return
clientId
;
this
.
ip
=
ip
;
return
this
;
}
}
public
void
setClientId
(
String
clientId
)
{
public
MqttClientCreator
port
(
int
port
)
{
this
.
clientId
=
clientId
;
this
.
port
=
port
;
return
this
;
}
}
public
MqttVersion
getProtocolVersion
()
{
public
MqttClientCreator
timeout
(
int
timeout
)
{
return
protocolVersion
;
this
.
timeout
=
timeout
;
return
this
;
}
}
public
void
setProtocolVersion
(
MqttVersion
protocolVersion
)
{
public
MqttClientCreator
keepAliveSecs
(
int
keepAliveSecs
)
{
this
.
protocolVersion
=
protocolVersion
;
this
.
keepAliveSecs
=
keepAliveSecs
;
return
this
;
}
}
public
String
getUsername
()
{
public
MqttClientCreator
sslConfig
(
SslConfig
sslConfig
)
{
return
username
;
this
.
sslConfig
=
sslConfig
;
return
this
;
}
}
public
void
setUsername
(
String
username
)
{
public
MqttClientCreator
reconnect
(
boolean
reconnect
)
{
this
.
username
=
username
;
this
.
reconnect
=
reconnect
;
return
this
;
}
}
public
String
getPassword
()
{
public
MqttClientCreator
reInterval
(
long
reInterval
)
{
return
password
;
this
.
reInterval
=
reInterval
;
return
this
;
}
}
public
void
setPassword
(
String
password
)
{
public
MqttClientCreator
clientId
(
String
clientId
)
{
this
.
password
=
password
;
this
.
clientId
=
clientId
;
return
this
;
}
}
public
boolean
isCleanSession
()
{
public
MqttClientCreator
protocolVersion
(
MqttVersion
protocolVersion
)
{
return
cleanSession
;
this
.
protocolVersion
=
protocolVersion
;
return
this
;
}
}
public
void
setCleanSession
(
boolean
cleanSession
)
{
public
MqttClientCreator
username
(
String
username
)
{
this
.
cleanSession
=
cleanSession
;
this
.
username
=
username
;
return
this
;
}
}
public
MqttWillMessage
getWillMessage
()
{
public
MqttClientCreator
password
(
String
password
)
{
return
willMessage
;
this
.
password
=
password
;
return
this
;
}
public
MqttClientCreator
cleanSession
(
boolean
cleanSession
)
{
this
.
cleanSession
=
cleanSession
;
return
this
;
}
}
public
void
setW
illMessage
(
MqttWillMessage
willMessage
)
{
public
MqttClientCreator
w
illMessage
(
MqttWillMessage
willMessage
)
{
this
.
willMessage
=
willMessage
;
this
.
willMessage
=
willMessage
;
return
this
;
}
}
public
MqttClientCreator
willMessage
(
Consumer
<
MqttWillMessage
.
Builder
>
consumer
)
{
MqttWillMessage
.
Builder
builder
=
MqttWillMessage
.
builder
();
consumer
.
accept
(
builder
);
return
willMessage
(
builder
.
build
());
}
public
MqttClientCreator
processor
(
MqttClientProcessor
processor
)
{
this
.
processor
=
Objects
.
requireNonNull
(
processor
);
return
this
;
}
public
MqttClient
connect
()
throws
Exception
{
// 1. 初始化 mqtt 处理器
ClientAioHandler
clientAioHandler
=
new
MqttClientAioHandler
(
Objects
.
requireNonNull
(
this
.
processor
));
ClientAioListener
clientAioListener
=
new
MqttClientAioListener
(
this
);
// 2. 重连
ReconnConf
reconnConf
=
null
;
if
(
this
.
reconnect
)
{
if
(
reInterval
!=
null
&&
reInterval
>
0
)
{
reconnConf
=
new
ReconnConf
(
reInterval
);
}
else
{
reconnConf
=
new
ReconnConf
();
}
}
// tioClient
TioClient
tioClient
=
new
TioClient
(
new
ClientTioConfig
(
clientAioHandler
,
clientAioListener
,
reconnConf
));
ClientChannelContext
context
=
tioClient
.
connect
(
new
Node
(
this
.
ip
,
this
.
port
),
this
.
timeout
);
return
new
MqttClient
(
tioClient
,
this
,
context
);
}
}
}
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/common/MqttMessageListener.java
0 → 100644
浏览文件 @
2e825615
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.net.dreamlu.net).
*
* 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.
*/
package
net.dreamlu.iot.mqtt.core.common
;
import
java.nio.ByteBuffer
;
/**
* mqtt 消息处理
*
* @author L.cm
*/
@FunctionalInterface
public
interface
MqttMessageListener
{
/**
* 监听到消息
*
* @param topic topic
* @param payload payload
*/
void
onMessage
(
String
topic
,
ByteBuffer
payload
);
}
mica-mqtt-example/src/main/java/net/dreamlu/iot/mqtt/client/MqttClientTest.java
浏览文件 @
2e825615
package
net.dreamlu.iot.mqtt.client
;
package
net.dreamlu.iot.mqtt.client
;
import
net.dreamlu.iot.mqtt.codec.*
;
import
net.dreamlu.iot.mqtt.core.client.MqttClient
;
import
net.dreamlu.iot.mqtt.core.client.MqttClientAioHandler
;
import
net.dreamlu.iot.mqtt.core.client.MqttClientAioListener
;
import
net.dreamlu.iot.mqtt.core.client.MqttClientConfig
;
import
net.dreamlu.iot.mqtt.core.client.MqttClientProcessor
;
import
org.tio.client.ClientChannelContext
;
import
org.tio.client.ClientTioConfig
;
import
org.tio.client.ReconnConf
;
import
org.tio.client.TioClient
;
import
org.tio.client.intf.ClientAioHandler
;
import
org.tio.client.intf.ClientAioListener
;
import
org.tio.core.Node
;
import
org.tio.core.Tio
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.util.Timer
;
import
java.util.Timer
;
...
@@ -26,31 +14,19 @@ import java.util.TimerTask;
...
@@ -26,31 +14,19 @@ import java.util.TimerTask;
public
class
MqttClientTest
{
public
class
MqttClientTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
MqttClientProcessor
processor
=
new
MqttClientProcessorImpl
();
// 初始化 mqtt 客户端
ClientAioHandler
clientAioHandler
=
new
MqttClientAioHandler
(
processor
);
MqttClient
client
=
MqttClient
.
create
()
// 暂时用 set 后期抽成 builder
.
clientId
(
"MqttClientTest"
)
MqttClientConfig
clientConfig
=
new
MqttClientConfig
();
.
username
(
"admin"
)
clientConfig
.
setClientId
(
"MqttClientTest"
);
.
password
(
"123456"
)
clientConfig
.
setUsername
(
"admin"
);
.
processor
(
new
MqttClientProcessorImpl
())
clientConfig
.
setPassword
(
"123456"
);
.
connect
();
//
ClientAioListener
clientAioListener
=
new
MqttClientAioListener
(
clientConfig
);
ReconnConf
reconnConf
=
new
ReconnConf
();
ClientTioConfig
tioConfig
=
new
ClientTioConfig
(
clientAioHandler
,
clientAioListener
,
reconnConf
);
TioClient
tioClient
=
new
TioClient
(
tioConfig
);
ClientChannelContext
context
=
tioClient
.
connect
(
new
Node
(
"127.0.0.1"
,
1883
),
1000
);
Timer
timer
=
new
Timer
();
Timer
timer
=
new
Timer
();
timer
.
schedule
(
new
TimerTask
()
{
timer
.
schedule
(
new
TimerTask
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(!
context
.
isClosed
)
{
client
.
publish
(
"testtopicxx"
,
ByteBuffer
.
wrap
(
"mica最牛皮"
.
getBytes
()));
MqttPublishMessage
message
=
(
MqttPublishMessage
)
MqttMessageFactory
.
newMessage
(
new
MqttFixedHeader
(
MqttMessageType
.
PUBLISH
,
false
,
MqttQoS
.
AT_MOST_ONCE
,
false
,
0
),
new
MqttPublishVariableHeader
(
"testtopicxx"
,
0
),
ByteBuffer
.
wrap
(
"mica最牛皮"
.
getBytes
()));
Tio
.
send
(
context
,
message
);
}
}
}
},
1000
,
2000
);
},
1000
,
2000
);
...
...
mica-mqtt-example/src/main/java/net/dreamlu/iot/mqtt/server/MqttServerTest.java
浏览文件 @
2e825615
...
@@ -54,6 +54,6 @@ public class MqttServerTest {
...
@@ -54,6 +54,6 @@ public class MqttServerTest {
},
1000
,
2000
);
},
1000
,
2000
);
// 启动
// 启动
tioServer
.
start
(
"
127.0.0.1
"
,
socketPort
);
tioServer
.
start
(
"
0.0.0.0
"
,
socketPort
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录