模块 ngx_stream_mqtt_filter_module


示例Directives
mqtt
mqtt_buffers
mqtt_rewrite_buffer_size
mqtt_set_connect

该模块 (1.23.4) 提供 支持消息队列遥测传输协议 (MQTT) 版本 3.1.15.0ngx_stream_mqtt_filter_module

此模块作为我们商业订阅的一部分提供。

示例配置

listen            127.0.0.1:18883;
proxy_pass        backend;
proxy_buffer_size 16k;

mqtt             on;
mqtt_set_connect clientid "$client";
mqtt_set_connect username "$name";

Directives

语法: mqtt on | off;
默认值:
mqtt off;
上下文: stream,server

为给定的虚拟服务器启用 MQTT 协议。

语法: mqtt_buffers number size;
默认值:
mqtt_buffers 100 1k;
上下文: stream,server

该Directives出现在版本 1.25.1 中。

设置缓冲区的 和 用于处理 MQTT 消息, 对于单个连接。numbersize

语法: mqtt_rewrite_buffer_size size;
默认值:
mqtt_rewrite_buffer_size 4k|8k;
上下文: server

该Directives自 1.25.1 版本起已过时。 应改用 mqtt_buffers Directives。

设置缓冲区的 用于编写修改后的消息。 默认情况下,缓冲区大小等于一个内存页。 这是 4K 或 8K,具体取决于平台。 但是,它可以做得更小。size

语法: mqtt_set_connect field value;
默认值:
上下文: server

将消息设置为 CONNECT 消息的给定值。 支持以下字段:、 和 。 该值可以包含文本、变量及其组合。fieldvalueclientidusernamepassword

多个Directives 可以在同一级别上指定:mqtt_set_connect

mqtt_set_connect clientid "$client";
mqtt_set_connect username "$name";