liveBook · Manning

Runtime linking

As explained in Server-Side WebAssembly

Runtime linking is the dynamic establishment and management of connections between separately running software components during execution.

Runtime linking dynamically connects separately running Wasm components during execution instead of combining them into one binary at build time. wasmCloud establishes and manages these links through wadm and NATS, using component-native wRPC so components can communicate across hosts. section 6.1

A runtime-linked wasmCloud application combines:

  • A Wasm component that exports the HTTP incoming-handler interface. section 6.1
  • An HTTP capability provider that invokes the component through a manifest-defined link. section 6.1
  • A NATS lattice that carries communication whether components share a host or run on different hosts. section 6.1

Linking an HTTP component

Define an HTTP capability in wadm.yaml, target the http-component, select the wasi/http incoming-handler interface, and provide an address such as 127.0.0.1:8000. Start the environment with wash up -d, build with wash build, deploy with wash app deploy ./wadm.yaml, and verify with curl http://127.0.0.1:8000, which returns “Hello from Rust!”. section 6.1

Listing 6.4 wadm.yaml file (template comments/annotations hidden)
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: rust-hello-world
  # ...
spec:
  components:
    - name: http-component
      type: component
      properties:
        image: file://./build/http_hello_world_s.wasm
      traits:
        - type: spreadscaler  #1
          properties:   #1
            instances: 1   #1

    - name: httpserver  #2
      type: capability   #2
      properties: #2
        image: ghcr.io/wasmcloud/http-server:0.23.2   #2
      traits:
        - type: link  #3
          properties:   #3
            target: http-component   #3
            namespace: wasi   #3
            package: http   #3
            interfaces: [incoming-handler]   #3
            source_config: #3
              - name: default-http
                properties:
                  address: 127.0.0.1:8000

Inspect the wadm manifest that declares the component, capability provider, and runtime link. section 6.1

How Server-Side WebAssembly covers it

How deep it goes
Explains manifest links, NATS communication, and wRPC placement across hosts, but does not detail the linking protocol internals.
Examples
Uses a Rust HTTP component, a wasmCloud HTTP server, a wadm manifest, local deployment commands, and a curl response.
What it assumes
Assumes familiarity with Wasm component composability while building the component and deployment setup incrementally.
What you can do after
Operate/configure runtime links by declaring wadm connections, deploying with wash, and testing an HTTP endpoint.
How it connects
Ties runtime linking to WebAssembly components, capability providers, NATS, wRPC, RPC, and distributed systems.

This explainer was generated by Manning's knowledge graph from the text of Server-Side WebAssembly. The section links point to the parts of the book it draws on.