mqtt.conf.example 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. ##--------------------------------------------------------------------
  2. ## MQTT
  3. ##
  4. ## MQTT configuration
  5. ##--------------------------------------------------------------------
  6. ## Note: This is an example of how to configure this feature
  7. ## you should copy and paste the below data into the emqx.conf for working
  8. mqtt {
  9. ## After the TCP connection is established,
  10. ## if the MQTT CONNECT packet from the client is not received within the time specified by idle_timeout, the connection will be disconnected
  11. ## Type:
  12. ## - infinity :: Never disconnect
  13. ## - Time Duration :: The idle time
  14. idle_timeout = 15s
  15. ## Maximum MQTT packet size allowed
  16. max_packet_size = 1MB
  17. ## Maximum allowed length of MQTT Client ID
  18. ## Type: Rnage from 23 to 65535
  19. max_clientid_len = 65535
  20. ## Maximum topic levels allowed
  21. ## Type: Range from 1 to 65535
  22. max_topic_levels = 128
  23. ## Maximum QoS allowed
  24. max_qos_allowed = 2
  25. ## Maximum topic alias, 0 means no topic alias supported
  26. ## Type: Range from 0 to 65535
  27. max_topic_alias = 65535
  28. ## Whether to enable support for MQTT retained message
  29. retain_available = true
  30. ## Whether to enable support for MQTT wildcard subscription
  31. wildcard_subscription = true
  32. ## Whether to enable support for MQTT shared subscription
  33. shared_subscription = true
  34. ## Whether to enable support for MQTT exclusive subscription
  35. exclusive_subscription = false
  36. ## Ignore loop delivery of messages for MQTT v3.1.1/v3.1.0, similar to No Local subscription option in MQTT 5.0
  37. ignore_loop_deliver = false
  38. ## Parse MQTT messages in strict mode.
  39. ## When set to true, invalid utf8 strings in for example client ID, topic name, etc. will cause the client to be disconnected
  40. strict_mode = false
  41. ## Specify the response information returned to the client
  42. response_information = ""
  43. ## The keep alive that EMQX requires the client to use
  44. ## Type:
  45. ## - disabled :: the keep alive specified by the client will be used
  46. ## - Integer :: Keepalive time, only applicable to clients using MQTT 5.0 protocol
  47. server_keepalive = disabled
  48. ## Keep-Alive Timeout = Keep-Alive interval × Keep-Alive Multiplier
  49. keepalive_multiplier = 1.5
  50. ## Maximum number of subscriptions allowed per client
  51. ## Type: infinity | Integer
  52. max_subscriptions = infinity
  53. ## Force upgrade of QoS level according to subscription
  54. upgrade_qos = false
  55. ## Maximum number of QoS 1 and QoS 2 messages that are allowed to be delivered simultaneously before completing the acknowledgment
  56. ## Type: Range from 1 to 65535
  57. max_inflight = 32
  58. ## Retry interval for QoS 1/2 message delivering
  59. retry_interval = 30s
  60. ## For each publisher session, the maximum number of outstanding QoS 2 messages pending on the client to send PUBREL
  61. ## Type: infinity | Integer
  62. max_awaiting_rel = 100
  63. ## For client to broker QoS 2 message, the time limit for the broker to wait before the PUBREL message is received
  64. await_rel_timeout = 300s
  65. ## Specifies how long the session will expire after the connection is disconnected, only for non-MQTT 5.0 connections
  66. session_expiry_interval = 2h
  67. ## Maximum queue length. Enqueued messages when persistent client disconnected, or inflight window is full
  68. ## Type: infinity | Integer
  69. max_mqueue_len = 1000
  70. ## Specifies whether to store QoS 0 messages in the message queue while the connection is down but the session remains
  71. mqueue_store_qos0 = true
  72. ## Whether to user Client ID as Username
  73. use_username_as_clientid = false
  74. ## Use the CN, DN field in the peer certificate or the entire certificate content as Username
  75. ## Type:
  76. ## - disabled
  77. ## - cn :: CN field of the certificate
  78. ## - dn :: DN field of the certificate
  79. ## - crt :: the content of the DER or PEM certificate
  80. ## - pem :: PEM format content converted from DER certificate content
  81. ## - md5 :: the MD5 value of the content of the DER or PEM certificate
  82. peer_cert_as_username = disabled
  83. ## Use the CN, DN field in the peer certificate or the entire certificate content as Client ID
  84. ## Type: See the above
  85. peer_cert_as_clientid = disabled
  86. ## Dispatch strategy for shared subscription
  87. ## Type:
  88. ## - random :: dispatch the message to a random selected subscriber
  89. ## - round_robin :: select the subscribers in a round-robin manner
  90. ## - round_robin_per_group :: select the subscribers in round-robin fashion within each shared subscriber group
  91. ## - local :: select random local subscriber otherwise select random cluster-wide
  92. ## - sticky :: always use the last selected subscriber to dispatch, until the subscriber disconnects.
  93. ## - hash_clientid :: select the subscribers by hashing the `clientIds`
  94. ## - hash_topic :: select the subscribers by hashing the source topic"""
  95. shared_subscription_strategy = round_robin
  96. }