Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

manifold:net 0.2.0

Contract reference · Payloads · contract.json (crates/manifold-wasm-abi/wit/contract.json)

Contract 0.2.0, track 0.2: open, unreleased. Nothing on track 0.2 is released yet, so any item may still change in place (spec §7.2).

InterfaceKindConsentSidesOwner
mod-channelimportlistedbothenki

Interface mod-channel

import · consent listed · sides both · owner enki · since 0.2.0

Typed messages between a mod’s client and server halves (Enki B §4). Both sides; consent class listed (a mod talking to its own halves).

A mod declares its channels in its declarations (ModDeclarations channels) and names each by its declaration position, channel below. Both sides derive the same wire handles from the same declarations, so none are exchanged (Enki B issue 31). Payloads are the mod’s own postcard-encoded message type, named by the channel’s declaration (opaque mod-message, described by the mod’s ModMessage type).

Calls work inside the mod’s own systems, where the host lends the world; outside one they fail with outside-system, and take-inbound is empty. Chunked transfers (§4.4) join this interface when they are built.

Functions

broadcast

broadcast: func(channel: u16, payload: list<u8>, except: option<u64>) -> result<_, send-error>

Server side: to every connected player but except.

send

send: func(channel: u16, payload: list<u8>) -> result<_, send-error>

Client side: to this mod’s server half.

send-to

send-to: func(peer: u64, channel: u16, payload: list<u8>) -> result<_, send-error>

Server side: to one connected player’s client half.

take-inbound

take-inbound: func() -> list<inbound>

Both sides: messages delivered to this mod since the last call, in delivery order.

Types

inbound (record)

FieldTypeAbout
channelu16
fromoption<sender>None on the client, where the sender is the server.
payloadlist<u8>

permission-level (alias)

= core/types.permission-level

player-ref (alias)

= core/types.player-ref

send-error (variant)

IndexCasePayloadAbout
0unknown-channelnone
1wrong-directionnone
2too-largenone
3rate-limitednone
4not-connectednone
5wrong-sidenone
6outside-systemnone

sender (record)

Who sent a message the server half receives, captured at delivery.

FieldTypeAbout
playerplayer-ref
levelpermission-level
nodeslist<string>Nodes this mod declared, or platform ones it references, that the sender holds.
limitslist<tuple<string, s64>>Values of the limits this mod declared or references (§8.7).