A Go web and realtime for Nakama game server. Works with wasm builds.
go get github.com/ascii8/nakama-go
package nakama_test
import (
"context"
"fmt"
"log"
"github.com/ascii8/nakama-go"
)
func Example() {
const id = "6d0c9e83-8385-48a8-8601-060b8f6a3bf6"
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// create client
cl := nakama.New(nakama.WithServerKey("apitest_server"))
// authenticate
if err := cl.AuthenticateDevice(ctx, id, true, ""); err != nil {
log.Fatal(err)
}
// retrieve account
account, err := cl.Account(ctx)
if err != nil {
log.Fatal(err)
}
// list devices on the account
for _, d := range account.Devices {
fmt.Println("id:", d.Id)
}
// Output:
// id: 6d0c9e83-8385-48a8-8601-060b8f6a3bf6
}
See the Go package documentation for more examples.
github.com/ascii8/nktest
- a Nakama test runner.github.com/ascii8/xoxo-go
- a Go version of Nakama's phaserjs xoxo example. Uses Ebitengine