Setting Up the Room Module on the Server

Overview

The Room module can be set up on both TCP and UDP servers.

Setup

To expose built-in commands to the client, you can set up using the diarkisexec package.

Add the following to your server's main function. Below is a sample setup for a UDP server. Note that the diarkisexec setup function must be executed before calling diarkisexec.StartDiarkis().

For more details, please refer to the Diarkisexec API Reference.

package main

import "github.com/Diarkis/diarkis/diarkisexec"

func main() {
	logConfigPath := "/configs/shared/log.json"
	meshConfigPath := ""

	diarkisexec.SetupDiarkis(logConfigPath, meshConfigPath, &diarkisexec.Modules{
		Room:       &diarkisexec.Options{ExposeCommands: true},
	})
	diarkisexec.SetupDiarkisUDPServer("/configs/udp/main.json")
	diarkisexec.StartDiarkis()
}

It's recommended to use the server template for an easy server setup. You can start with it by referring to Diarkis Server Template.

Last updated