feat: Python/Java SDK 接入清单与打包文档
对真实 nixmsg 跑 DEVELOPMENT 第 9 节接入清单(跳过仅 JS 跨域),补 README/示例,并修 Paho/HiveMQ 真机联调死锁与鉴权分类。
This commit is contained in:
+37
-4
@@ -2,7 +2,7 @@
|
||||
|
||||
坐标:`asia.asio.nixmsg:nixmsg-sdk`
|
||||
包名:`asia.asio.nixmsg`
|
||||
字节码目标:Java 8
|
||||
字节码目标:Java 8(`maven.compiler.release=8`)
|
||||
接口:`CompletableFuture`
|
||||
|
||||
## Android
|
||||
@@ -17,7 +17,15 @@ Maven / Gradle 仓库:
|
||||
https://git.asio.asia/api/packages/nixevol/maven
|
||||
```
|
||||
|
||||
HiveMQ MQTT Client(含 WebSocket:`webSocketConfig` + `netty-codec-http`)。
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>asia.asio.nixmsg</groupId>
|
||||
<artifactId>nixmsg-sdk</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
HiveMQ MQTT Client(WebSocket:`webSocketConfig` + `netty-codec-http`)。
|
||||
|
||||
## 最小示例
|
||||
|
||||
@@ -26,9 +34,34 @@ Client c = new Client();
|
||||
c.onSession(token -> { /* 应用保存 */ });
|
||||
c.onMessage(msg -> System.out.println(msg.id + " " + msg.body.data));
|
||||
c.connect("ws://127.0.0.1:7443/mqtt", "device-1", "secret", null)
|
||||
.thenCompose(v -> c.send(new Types.Target("endpoint", "device-2"), new Types.Body("hello"), new Types.SendOptions()))
|
||||
.thenCompose(v -> {
|
||||
Types.SendOptions opt = new Types.SendOptions();
|
||||
opt.delayMs = 0L;
|
||||
return c.send(new Types.Target("endpoint", "device-2"), new Types.Body("hello"), opt);
|
||||
})
|
||||
.join();
|
||||
c.close();
|
||||
```
|
||||
|
||||
许可证见 `LICENSE`(专有)。
|
||||
命令行示例类:`asia.asio.nixmsg.examples.MinimalExample`。
|
||||
|
||||
## 打包(不发布)
|
||||
|
||||
```bash
|
||||
mvn package -DskipTests
|
||||
# 产物 target/nixmsg-sdk-0.1.0.jar;勿部署到 Maven 仓库;正式发布由总控在阶段 3 执行
|
||||
```
|
||||
|
||||
确认字节码为 8:`javap -v target/classes/asia/asio/nixmsg/Client.class | findstr major`(应为 52)。
|
||||
|
||||
## 测试
|
||||
|
||||
```bash
|
||||
mvn test
|
||||
```
|
||||
|
||||
含假传输单元测试与 DEVELOPMENT 第 9 节接入清单(会编译并启动真实 `nixmsg`)。可用环境变量 `NIXMSG_BIN` 指定已编译二进制。跳过仅 JS 的跨域项。
|
||||
|
||||
## 许可证
|
||||
|
||||
见 `LICENSE`(Proprietary)。
|
||||
|
||||
Reference in New Issue
Block a user