Contexts & Applications
An application is a WASM bundle on a node; a context is a running instance
of its shared state. This guide walks the lifecycle install → create context →
join, all on mero.admin. Every method is async throws. The full surface is in
the admin API reference.
The lifecycle
Section titled “The lifecycle”Install an application
Section titled “Install an application”By coordinates — a package name and a published version:
let installed = try await mero.admin.installApplication( InstallApplicationRequest(package: "com.calimero.chat", version: "3.1.1"))let applicationId = installed.applicationIdWhere the bytes come from is the node’s decision, not the caller’s: it fetches
from the single registry its own [registry] config names, and accepts the
download only if the blob id matches. core 0.11.0-rc.32 removed URL installs
outright (core#3652), and refuses a body carrying url rather than
reinterpreting it — so there is no URL form of this call to fall back to.
A node whose registry has nothing published at those coordinates answers 502
with the configured <mode> source has no application published at <pkg>@<ver>.
That is retryable: the version may simply not be published yet.
To pick a version, list what the registry has (an off-node call — the node’s own
listPackageVersions reports only what is installed):
let versions = try await mero.admin.getRegistryVersions( registryUrl: registryURL, packageName: "my-package") // newest first
let app = try await mero.admin.installFromRegistry( packageName: "my-package", version: versions[0])List from the same registry the node installs from. If the two differ, a version this listing offers is one the node will answer 502 for.
During development, install from a path with installDevApplication(_:).
Inspect and manage:
let apps = try await mero.admin.listApplications().appslet app = try await mero.admin.getApplication(applicationId)_ = try await mero.admin.uninstallApplication(applicationId)Create a context
Section titled “Create a context”let created = try await mero.admin.createContext( CreateContextRequest(applicationId: applicationId, groupId: groupId))let contextId = created.contextIdlet memberKey = created.memberPublicKeyFor a multi-service application, name the service:
let ctx = try await mero.admin.createContext( CreateContextRequest(applicationId: applicationId, groupId: groupId, serviceName: "chat"))List and inspect:
let contexts = try await mero.admin.getContexts().contexts // [ContextWithGroup]let one = try await mero.admin.getContext(contextId) // Contextlet forApp = try await mero.admin.getContextsForApplication(applicationId)let storage = try await mero.admin.getContextStorage(contextId).sizeInBytesIdentities & joining
Section titled “Identities & joining”A context identity is your keypair within a context. Generate one, then join:
let identity = try await mero.admin.generateContextIdentity() // .publicKey_ = try await mero.admin.joinContext(contextId)
let all = try await mero.admin.getContextIdentities(contextId).identitieslet mine = try await mero.admin.getContextIdentitiesOwned(contextId).identitiesKeeping state in sync
Section titled “Keeping state in sync”try await mero.admin.syncContext(contextId) // request a synclet r = try await mero.admin.resyncContext(contextId, request: ResyncContextRequest(force: true))- Executing methods — run WASM methods in a context.
- Groups & governance — namespaces, members, capabilities.