Skip to content
This repository was archived by the owner on Oct 21, 2026. It is now read-only.
wasmCloudPublic archive

About

SDK for writing wasmCloud actors in TinyGo

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

Archived: This repository is no longer maintained and will not receive updates or security fixes. It belongs to an earlier version of wasmCloud. For current wasmCloud, see https://github.com/wasmCloud/wasmCloud.

wasmCloud TinyGo Actor SDK

This module is for those looking to develop wasmCloud actors using TinyGo. Typically you won't use this module directly, as it will be referenced by one or more code generate modules containing strongly-typed structs and wrappers around function handler registration.

A typical actor might look like this

package main

import (
	"github.com/wasmcloud/actor-tinygo"
	"github.com/wasmcloud/interfaces/httpserver/tinygo"
)

func main() {
	// In the main function, construct an instance of your actor, and pass in the instance,
	// followed by a handler for each of the interfaces you implement.
	// This actor responsds to http requests from the http server capability provider,
	// so it includes the HttpServerHandler.
	// All actors must include the ActorHandler and implement `HealthRequest`.
	me := Echo{}
	actor.RegisterHandlers(httpserver.HttpServerHandler(&me), actor.ActorHandler(&me))
}

type Echo struct{}

// HandleRequest implements the callback from the http server capability provider.
func (e *Echo) HandleRequest(ctx *actor.Context, arg httpserver.HttpRequest) (*httpserver.HttpResponse, error) {
	r := httpserver.HttpResponse{
		StatusCode: 200,
		Header:     make(httpserver.HeaderMap, 0),
		Body:       []byte("hello"),
	}
	return &r, nil
}

// HealthRequest implements the health check from the wasmcloud host.
func (e *Echo) HealthRequest(ctx *actor.Context, arg actor.HealthCheckRequest) (*actor.HealthCheckResponse, error) {
	var r actor.HealthCheckResponse
	r.Healthy = true
	return &r, nil
}

About

SDK for writing wasmCloud actors in TinyGo

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages