Subscriptions: The Core Primitive

Activating Somnia Reactivity

Subscriptions are configurable listeners that define what events to watch and how to deliver notifications. They're the foundation of reactivity—create one, and the chain does the rest.

Key Features

  • Filters: Wildcard (*) for all events, or specify emitters, topics.

  • On-chain

    • Costs: Minimum 32 SOM balance to cover handler invocation costs on-chain (validators execute handlers) + small amount of gas (~21K) to create each subscription

    • Options:

      • isGuaranteed: Eventual delivery with some block inclusion distance (true/false).

      • isCoalesced: Batch multiple events into one notification within a block.

      • Handler Gas params: priorityFeePerGas, maxFeePerGas, gasLimit

  • Off-chain

    • Costs: Cost of running the Somnia node or paying an RPC provider

Last updated