Config file

Here’s an example config file:

# auth plugin supports Mosquitto version 2 or FlashMQ native.
auth_plugin /path/to/

auth_plugin_serialize_init true
auth_plugin_serialize_auth_checks false

# The FlashMQ auth plugin interface has a function that is called
# periodically this amount of seconds.
auth_plugin_timer_period 60

log_file /var/log/flashmq.log
log_debug true
log_subscriptions true

allow_unsafe_clientid_chars false
allow_unsafe_username_chars false

# Must be power of two. Buffer will grow when necessary, and reset
# to this size after a while.
client_initial_buffer_size 1024

# MQTT packets are 256 MB max, approximately. This memory will
# (temporarily) be allocated upon arrival of such packets,
# so there may be cause to set it lower.
max_packet_size 268435461

# File with usernames and hashed passwords compatible with Mosquitto.
# You can use Mosquitto's mosquitto_passwd to manage the file.
mosquitto_password_file /foo/bar/mosquitto_passwd_file

# ACL (access control lists) for users, anonymous users
# and patterns expandable with %u (username) and %c (clientid).
# Format is Mosquitto's acl_file.
mosquitto_acl_file /foo/bar/mosquitto_acl_file

allow_anonymous true

# The general Linux default of 1024 can be overridden. Note: systemd
# blocks you from setting it, so it needs to be set on the unit.
rlimit_nofile 1000000

# Expire sessions after this time. Setting to 0 disables it, and is
# (MQTT3) standard-compliant. But, existing sessions cause load
# on the server (because they are still subscribers), so keeping
# sessions after any client that connects with a random ID doesn't
# make sense.
expire_sessions_after_seconds 1209600

# Location to store sessions, subscriptions and retained messages.
# Not specifying this will turn off persistence.
storage_dir /var/lib/flashmq

# These are essentially superfluous for MQTT >= 3.1.1 clients with
# cleansession=true. Packets don't need to be stored for those.
max_qos_msg_pending_per_client 65535
max_qos_bytes_pending_per_client 65536

# Is communicated towards MQTT5 clients.
max_incoming_topic_alias_value 65535

# FlashMQ will make this many aliases per MQTT5 client, if
# they ask for aliases.
max_outgoing_topic_alias_value 65535

listen {
  protocol mqtt
  inet_protocol ip4_ip6
  inet6_bind_address ::1
  fullchain /foobar/server.crt
  privkey /foobar/server.key

  # default = 8883
  port 8883
listen {
  protocol mqtt
  inet_protocol ip4

  # default = 1883
  port 1883
listen {
  protocol websockets
  fullchain /foobar/server.crt
  privkey /foobar/server.key

  # default = 4443
  port 4443
listen {
  protocol websockets

  # default = 8080
  port 8080