mm_mqtt_server 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/message.js +1 -1
- package/lib/mqtt_server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ const server = {
|
|
|
44
44
|
hasManager() { return false; }
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const mqtt = new MqttServer(
|
|
47
|
+
const mqtt = new MqttServer({ name: 'mqtt_server', host: '127.0.0.1', port: 1883 }, server);
|
|
48
48
|
|
|
49
49
|
// 主题守卫:check 阶段产出即短路
|
|
50
50
|
mqtt.getHandle().on('check', (ctx, params) => {
|
package/lib/message.js
CHANGED
|
@@ -37,7 +37,7 @@ const DEFAULT_CALL_PREFIX = 'rpc/call';
|
|
|
37
37
|
* 6. 无回环:代理重发的应答 client 为空,不进入消息管道。
|
|
38
38
|
*
|
|
39
39
|
* 用法:
|
|
40
|
-
* const mqtt = new MqttServer(
|
|
40
|
+
* const mqtt = new MqttServer({ name: 'mqtt_server', port: 1883 }, server);
|
|
41
41
|
* const rpc = new MessagePlugin({ reply_suffix: '/response', push_prefix: 'rpc/push' });
|
|
42
42
|
* mqtt.use(rpc);
|
|
43
43
|
* rpc.addMethod('echo', (params) => params);
|
package/lib/mqtt_server.js
CHANGED
|
@@ -36,7 +36,7 @@ const SERVER_SCHEMA = {
|
|
|
36
36
|
* 5. 主动操作:run(ctx, params) 按 params.action 派发 publish / close_client / list_clients。
|
|
37
37
|
*
|
|
38
38
|
* 用法:
|
|
39
|
-
* const mqtt = new MqttServer(
|
|
39
|
+
* const mqtt = new MqttServer({ name: 'mqtt_server', host: '127.0.0.1', port: 1883 }, server);
|
|
40
40
|
* mqtt.getHandle().on('check', (ctx, params) => {
|
|
41
41
|
* if (params.topic.startsWith('blocked/')) return { dropped: true };
|
|
42
42
|
* }, 100, 'guard');
|