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).
| Interface | Kind | Consent | Sides | Owner |
|---|---|---|---|---|
mod-channel | import | listed | both | enki |
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.
payload: opaque bytesmod-message.
send
send: func(channel: u16, payload: list<u8>) -> result<_, send-error>
Client side: to this mod’s server half.
payload: opaque bytesmod-message.
send-to
send-to: func(peer: u64, channel: u16, payload: list<u8>) -> result<_, send-error>
Server side: to one connected player’s client half.
payload: opaque bytesmod-message.
take-inbound
take-inbound: func() -> list<inbound>
Both sides: messages delivered to this mod since the last call, in delivery order.
Types
inbound (record)
| Field | Type | About |
|---|---|---|
channel | u16 | |
from | option<sender> | None on the client, where the sender is the server. |
payload | list<u8> |
payload: opaque bytesmod-message.
permission-level (alias)
= core/types.permission-level
player-ref (alias)
= core/types.player-ref
send-error (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | unknown-channel | none | |
| 1 | wrong-direction | none | |
| 2 | too-large | none | |
| 3 | rate-limited | none | |
| 4 | not-connected | none | |
| 5 | wrong-side | none | |
| 6 | outside-system | none |
sender (record)
Who sent a message the server half receives, captured at delivery.
| Field | Type | About |
|---|---|---|
player | player-ref | |
level | permission-level | |
nodes | list<string> | Nodes this mod declared, or platform ones it references, that the sender holds. |
limits | list<tuple<string, s64>> | Values of the limits this mod declared or references (§8.7). |