Configuration Section
All restrictions are configured within the<restrictions> element:
Maximum Connections
Limit the total number of concurrent MQTT client connections.Configuration
-1 (unlimited)Range: -1 or any positive number
Description
-1means unlimited connections (subject to license limits)- Any positive number limits concurrent connections to that value
- When the limit is reached, new connection attempts are rejected
Example
Maximum Client ID Length
Restrict the maximum length of client identifiers.Configuration
65535Range: 1-65535
Description
Clients attempting to connect with a client identifier longer than this limit will be disconnected.Example
Maximum Topic Length
Restrict the maximum length of topic names.Configuration
65535Range: 1-65535
Description
Publish and subscribe operations with topics longer than this limit will be rejected.Example
No-Connect Idle Timeout
Disconnect TCP connections that don’t send a CONNECT packet within the timeout period.Configuration
10000 milliseconds (10 seconds)Range: Minimum 1 millisecond
Description
After a TCP connection is established, the client must send a CONNECT packet within this timeout. If not, HiveMQ closes the connection. This prevents resource exhaustion from connections that never complete the MQTT handshake.Example
Incoming Bandwidth Throttling
Limit the global incoming bandwidth from all clients.Configuration
0 (unlimited)Unit: Bytes per second
Description
0means no throttling- Any positive number limits the total incoming bandwidth to that many bytes per second
- Useful for preventing bandwidth exhaustion
Example
Complete Example
Here’s a complete example with all restriction settings:Use Cases
Protect Against Resource Exhaustion
Strict Identifier and Topic Limits
Development/Testing (Relaxed Limits)
Monitoring
Monitor these metrics to determine appropriate restriction values:- Current connection count
- Connection rate
- Incoming bandwidth usage
- Client ID and topic lengths in your application
- Connection establishment time
Best Practices
- Set
max-connectionsbased on your infrastructure capacity and expected load - Keep
no-connect-idle-timeoutlow (5-10 seconds) to prevent connection attacks - Use
incoming-bandwidth-throttlingto prevent bandwidth exhaustion - Set realistic client ID and topic length limits based on your application
- Monitor rejection rates to ensure limits aren’t too restrictive
- Test limits under load before deploying to production
Related Configuration
- MQTT Settings - Configure message queuing and session limits
- Listeners - Configure network listeners
- Persistence - Configure data storage