Skip to content
forked from ascii8/nakama-go

Nakama web and realtime client for Go (works with WASM)

License

Notifications You must be signed in to change notification settings

jnowls/nakama-go

 
 

Repository files navigation

nakama

A Go web and realtime for Nakama game server. Works with wasm builds.

Tests Go Report Card Reference Releases

using

go get github.com/ascii8/nakama-go

quickstart

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
}

examples

See the Go package documentation for more examples.

related

About

Nakama web and realtime client for Go (works with WASM)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%