distribute/settings

Values

pub const default_max_message_size: Int

Default maximum message size: 10MB (10485760 bytes)

pub fn get_max_message_size() -> Int

Get the current maximum allowed message size in bytes.

Returns the configured limit, or 10MB if not explicitly set.

pub fn is_allow_atom_creation() -> Bool

Check if dynamic atom creation is currently allowed.

pub fn is_use_crypto_ids() -> Bool

Check if cryptographic identifiers are currently enabled.

pub fn set_allow_atom_creation(allow: Bool) -> Nil

Enable or disable dynamic atom creation from untrusted input.

When disabled (default), functions that would create atoms from external data will fail safely instead. This prevents atom table exhaustion attacks.

pub fn set_max_message_size(size: Int) -> Nil

Set the maximum allowed message size in bytes.

Messages larger than this limit will be rejected by messaging.send_binary and groups.broadcast_binary. This prevents memory exhaustion attacks from malicious or misconfigured peers.

Parameters

  • size: Maximum message size in bytes. Must be >= 0. Use 0 to disable size checking (not recommended for production).

Default

The default is 10MB (10,485,760 bytes), which is suitable for most use cases. Increase if you need to send larger payloads.

Example

// Allow messages up to 50MB
settings.set_max_message_size(50 * 1024 * 1024)

// Restore default
settings.set_max_message_size(settings.default_max_message_size)
pub fn set_use_crypto_ids(use_crypto: Bool) -> Nil

Enable or disable cryptographic identifiers for registry names.

When enabled, registry names are hashed using a secure algorithm to prevent name collision attacks.

Search Document