extends Node2D

var nakama_client: NakamaClient
var nakama_session: NakamaSession
var nakama_socket: NakamaSocket

func _ready() -> void:
	attempt_auth()

func _process(delta: float) -> void:
	pass
	
func attempt_auth() -> void:
	nakama_client = Nakama.create_client("defaultkey", "127.0.0.1", 7350, "http")
	nakama_session = await nakama_client.authenticate_device_async(OS.get_unique_id())
	nakama_socket = Nakama.create_socket_from(nakama_client)
	
	var connected: NakamaAsyncResult = await nakama_socket.connect_async(nakama_session)
	if connected.is_exception():
		print("An error occured: %s" % connected)
		return
	print("Oh baby we're ready.")
