1 Star 1 Fork 5

Hermit / SimpleMqttClient

forked from Xenos / SimpleMqttClient 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

SimpleMqttClient

介绍

基于org.eclipse.paho.client.mqttv3实现的一个简易的MQTT客户端

MQTT协议简介

MQTT全称为Message Queuing Telemetry Transport(消息队列遥测传输),是一种基于发布/订阅范式的“轻量级”消息协议,需要一个消息中间件

协议主要有三种身份:发布者(Publisher)代理服务器(Broker)订阅者(Subscriber)。发布者发布消息到代理服务器,再由订阅者消费消息。

这里我们选择EMQX作为代理服务器

编写一个简单的连接客户端

编写一个自定义的MQTT的客户端,我们需要实现一下几个方法:

  • 连接服务器
  • 订阅消息
  • 推送消息
  • 断开连接
  • 断线是否重连

以下代码是基于org.eclipse.paho.client.mqttv3实现的一个简单的客户端


/************************* Client ****************************************/

package xenoscode.cn.mqttclient.mqtt;

import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;

/**
 * @author Xenos
 * @version V1.0
 * @Package xenoscode.cn.mqttclient.mqtt
 * @date 2020/9/1 16:46
 */
public class SimpleMqttClient {
    /**
     * MQTT异步客户端
     */
    private MqttAsyncClient client = null;
    /**
     * 连接配置
     */
    private MqttConnectOptions options = null;
    /**
     * 客户端的ID,唯一且不可重复
     */
    private String clientid;
    private String userName;
    /**
     * 服务器地址
     */
    private String host;

    private int timeOut;
    private int aliveTime;
    /**
     * 订阅的主题列表
     */
    private String[] listTopic;
    /**
     * 主题列表对应的Qos列表
     */
    private int[] listQos;
    /**
     * 最大尝试连接次数
     */
    private int maxConnectTimes;

    public SimpleMqttClient(String clientid, String userName, String host, int timeOut, int aliveTime, String[] listTopic, int[] listQos, int maxConnectTimes) {
        this.clientid = clientid;
        this.userName = userName;
        this.host = host;
        this.timeOut = timeOut;
        this.aliveTime = aliveTime;
        this.listTopic = listTopic;
        this.listQos = listQos;
        this.maxConnectTimes = maxConnectTimes;
    }

    /**
     * 连接MQTT服务器
     */
    public synchronized void connect() {
        if (options == null) {
            setOptions();
        }
        if (client == null) {
            creatClient();
        }
        int connectTimes = 0;
        while (connectTimes < maxConnectTimes && !client.isConnected()) {
            try {
                IMqttToken token = client.connect(options);
                token.waitForCompletion();
                connectTimes++;
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println(clientid + " 连接时发生错误: " + e.toString());
            }
        }
    }

    /**
     * 断开与MQTT服务器的连接
     */
    public synchronized void disconnect() {
        if (client != null && client.isConnected()) {
            try {
                IMqttToken token = client.disconnect();
                token.waitForCompletion();
            } catch (MqttException e) {
                e.printStackTrace();
                System.out.println(clientid + " 断开连接时发生错误: " + e.toString());
            }
        }
        client = null;
    }

    /**
     * 刷新MQTT的连接
     */
    public synchronized void refresh() {
        disconnect();
        setOptions();
        creatClient();
        connect();
    }

    /**
     * 消息订阅
     */
    public void subscribe() {
        if (client != null && client.isConnected()) {
            try {
                IMqttToken token = client.subscribe(listTopic, listQos);
                token.waitForCompletion();
            } catch (MqttException e) {
                e.printStackTrace();
                System.out.println(clientid + "订阅主题时发生错误: " + e.toString());
            }
        }
    }

    /**
     * 消息推送
     *
     * @param topic   消息的主题名
     * @param message 消息报文
     */
    public void publish(String topic, MqttMessage message) {
        if (client != null && client.isConnected()) {
            try {
                IMqttDeliveryToken token = client.publish(topic, message);
                token.waitForCompletion();
            } catch (MqttException e) {
                e.printStackTrace();
                System.out.println(clientid + "推送消息时发生错误: " + e.toString());
            }
        }
    }

    /**
     * @return 是否处于连接状态
     */
    public boolean isConnected() {
        return client != null && client.isConnected();
    }

    public String getClientid() {
        return clientid;
    }

    public int getMaxConnectTimes() {
        return maxConnectTimes;
    }

    /**
     * 设置连接属性
     */
    private void setOptions() {
        if (options != null) {
            options = null;
        }
        options = new MqttConnectOptions();
        //将CleanSession设置为true时,一旦客户端断开连接,就会清除相关Session
        options.setCleanSession(true);
        options.setConnectionTimeout(timeOut);
        options.setKeepAliveInterval(aliveTime);
        options.setUserName(userName);
        //org.eclipse.paho.client.mqttv3提供的自动重连,默认为false,也可以在回调中进行重连
//        options.setAutomaticReconnect(true);
    }

    /**
     * 创建客户端
     */
    private void creatClient() {
        if (client == null) {
            try {
                // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存
                client = new MqttAsyncClient(host, clientid, new MemoryPersistence());
                // 设置回调函数
                client.setCallback(new SimpleMqttClientCallback(SimpleMqttClient.this));
            } catch (MqttException e) {
                e.printStackTrace();
                System.out.println("创建连接客户端实例: [" + clientid + "] 时发生错误:" + e.toString());
            }
        }
    }
}


/************************* 回调类 SimpleMqttClientCallback ****************************************/
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
import org.eclipse.paho.client.mqttv3.MqttMessage;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class SimpleMqttClientCallback implements MqttCallbackExtended {
    private SimpleMqttClient client;
    private int connectTimes = 0;

    public SimpleMqttClientCallback(SimpleMqttClient client) {
        this.client = client;
    }

    @Override
    public void connectComplete(boolean b, String s) {
        System.out.println("————" + client.getClientid() + " 连接成功!————");
        //连接成功后,自动订阅主题
        client.subscribe();
        connectTimes = 0;
    }

    @Override
    public void connectionLost(Throwable throwable) {
        System.out.println("————" + client.getClientid() + " 连接丢失!————");
        //可以在此处做重连处理
        if (connectTimes < client.getMaxConnectTimes()) {
            client.refresh();
            connectTimes++;
        } else {
            client.disconnect();
        }
    }

    @Override
    public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
        LocalDateTime startTime = LocalDateTime.now();
        System.out.println("[MQTT]" + client.getClientid() + " ----成功接收消息!---- 时间: " + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
        String content = new String(mqttMessage.getPayload());
        System.out.println("接收消息主题 : " + topic);
        System.out.println("接收消息Qos : " + mqttMessage.getQos());
        System.out.println("接收消息内容 : " + content);
    }

    @Override
    public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
        System.out.println("[MQTT]" + client.getClientid() + "  ----成功发送消息!---- 时间: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
    }
}

将客户端连接需要的一些属性写在配置文件中

mqtt:
  # emq的默认端口为1883
  host: tcp://127.0.0.1:1883
  client:
    clientid: testClient
    time-out: 10
    alive-time: 20
    max-connect-times: 5
    topics: ["HELLOWORLD"]
    qos: [2]

编写配置类


/******************** SimpleMqttClientProperties ***********************************/
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@Setter
@Getter
@ConfigurationProperties("mqtt.client")
public class SimpleMqttClientProperties {
    private String clientid;
    private String userName;
    private int timeOut;
    private int aliveTime;
    private int  maxConnectTimes;
    private String[] topics;
    private int[] qos;
}

/******************** SimpleMqttClientProperties ***********************************/
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import xenoscode.cn.mqttclient.mqtt.SimpleMqttClient;


@Configuration
public class MqttClientPoolConfiguration {
    @Value("${mqtt.host}")
    private String host;
    @Autowired
    private SimpleMqttClientProperties simpleMqttClientProperties;

    @Bean
    SimpleMqttClient mqttClient() {
        SimpleMqttClient mqttClient = new SimpleMqttClient(simpleMqttClientProperties.getClientid(),
                simpleMqttClientProperties.getUserName(),
                host,
                simpleMqttClientProperties.getTimeOut(),
                simpleMqttClientProperties.getAliveTime(),
                simpleMqttClientProperties.getTopics(),
                simpleMqttClientProperties.getQos(),
                simpleMqttClientProperties.getMaxConnectTimes());
        return mqttClient;
    }
}

初始化连接


/************************* 启动类 ********************************/
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SimpleMqttPoolApplication {

    public static void main(String[] args) {
        SpringApplication.run(SimpleMqttPoolApplication.class, args);
    }

}

/************************* Initialize ********************************/
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import xenoscode.cn.mqttclient.mqtt.SimpleMqttClient;

@Component
public class Initialize implements CommandLineRunner {
    @Autowired
    private SimpleMqttClient simpleMqttClient;

    @Override
    public void run(String... args) throws Exception {
        simpleMqttClient.connect();
    }
}

实现CommandLineRunner接口,并重写run方法,可以让其中的方法在Spring Boot项目启动后执行

看一下运行结果

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.3.RELEASE)

2020-09-04 23:18:45.647  INFO 5580 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : Starting SimpleMqttPoolApplication on Xenos with PID 5580 (D:\study\workspace\SimpleMqttPool\target\classes started by 89314 in D:\study\workspace\SimpleMqttPool)
2020-09-04 23:18:45.649  INFO 5580 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : No active profile set, falling back to default profiles: default
2020-09-04 23:18:46.088  INFO 5580 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : Started SimpleMqttPoolApplication in 0.747 seconds (JVM running for 1.031)
————testClient 连接成功!————

可以看到日志中输出连接成功的字样,为了确定是否真的连接成功,我们可以登录EMQ的Dashboard查看(dashboard的默认端口为18083,用户名为admin,密码为public):

login

client

可以看到客户端与服务器确实已经连接,在看一下是否有主题的订阅

subscribe

对订阅进行测试

点击Tools,在WebSocket中,可以进行订阅和推送的测试

连接测试用的客户端

test client

推送测试报文

publish test

查看日志输出是否接收到报文


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.3.RELEASE)

2020-09-04 23:18:45.647  INFO 5580 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : Starting SimpleMqttPoolApplication on Xenos with PID 5580 (D:\study\workspace\SimpleMqttPool\target\classes started by 89314 in D:\study\workspace\SimpleMqttPool)
2020-09-04 23:18:45.649  INFO 5580 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : No active profile set, falling back to default profiles: default
2020-09-04 23:18:46.088  INFO 5580 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : Started SimpleMqttPoolApplication in 0.747 seconds (JVM running for 1.031)
————testClient 连接成功!————
[MQTT]testClient ----成功接收消息!---- 时间: 2020-09-04 23:44:51.753
接收消息主题 : HELLOWORLD
接收消息Qos : 2
接收消息内容 : { "msg": "Hello, World!" }

可以看到我们的自定义的客户端成功接收到了来自另外一个客户端的消息。

进行消息推送测试

编写一个测试用的Controller,每次访问该地址都想服务端推送一条测试报文

import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import xenoscode.cn.mqttclient.mqtt.SimpleMqttClient;

@RestController
public class TestController {
    @Autowired
    private SimpleMqttClient simpleMqttClient;

    @GetMapping("/test/publish")
    public void publishTest() {
        byte[] payload = "publish test".getBytes();
        MqttMessage mqttMessage = new MqttMessage();
        mqttMessage.setQos(2);
        mqttMessage.setPayload(payload);
        String topic = "PUBLISH_TEST";
        simpleMqttClient.publish(topic, mqttMessage);
    }
}

在dashboard中订阅该主题

publish test

访问接口,查看结果

后台日志


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.3.RELEASE)

2020-09-04 23:59:20.843  INFO 3016 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : Starting SimpleMqttPoolApplication on Xenos with PID 3016 (D:\study\workspace\SimpleMqttPool\target\classes started by 89314 in D:\study\workspace\SimpleMqttPool)
2020-09-04 23:59:20.845  INFO 3016 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : No active profile set, falling back to default profiles: default
2020-09-04 23:59:21.507  INFO 3016 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-09-04 23:59:21.515  INFO 3016 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-09-04 23:59:21.515  INFO 3016 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-09-04 23:59:21.581  INFO 3016 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-09-04 23:59:21.581  INFO 3016 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 698 ms
2020-09-04 23:59:21.747  INFO 3016 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-04 23:59:21.863  INFO 3016 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-09-04 23:59:21.869  INFO 3016 --- [           main] x.cn.mqttpool.SimpleMqttPoolApplication  : Started SimpleMqttPoolApplication in 1.321 seconds (JVM running for 1.621)
————testClient 连接成功!————
2020-09-04 23:59:24.962  INFO 3016 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-09-04 23:59:24.962  INFO 3016 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-09-04 23:59:24.965  INFO 3016 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 3 ms
[MQTT]testClient  ----成功发送消息!---- 时间: 2020-09-04 23:59:24.983

Dashboard结果

publish test

可以看到当前的客户端能够将数据上送到服务器中

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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.

简介

基于org.eclipse.paho.client.mqttv3的mqtt客户端的简单实现 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/hermit2020/simple-mqtt-client.git
git@gitee.com:hermit2020/simple-mqtt-client.git
hermit2020
simple-mqtt-client
SimpleMqttClient
master

搜索帮助