heroiclabs/nakama-godot-demo

Please help 😭

izzyaboi opened this issue · 4 comments

Im getting this error after trying to run this function (trying to connect to the server)

These are all the variables associated with the function
var client := Nakama.create_client(Server_KEY, "127.0.0.1", 7350, "http")
var Session : NakamaSession
var Socket : NakamaSocket

func Connect_to_server_async():
Socket = Nakama.create_socket_from(client)
var result : NakamaAsyncResult = yield(Socket.connect_async(Session), "completed")
if not result.is_exception():
Socket.connect("closed", self, "Nakama_Socket_Closed")
return OK
return ERR_CANT_CONNECT

Invalid get index 'token' (on base: 'Nil').

@izzyaboi Is your Session var initialized? Have you authenticated the game client before you use the session to open a socket? https://github.com/heroiclabs/nakama-godot#authenticate

@izzyaboi Is your Session var initialized? Have you authenticated the game client before you use the session to open a socket? https://github.com/heroiclabs/nakama-godot#authenticate

I think so but i might be wrong you be the judge of that, this is my code and the error code im getting @novabyte
Annotation 2020-09-07 202512
Annotation 2020-09-07 202539
Annotation 2020-09-07 202559

@izzyaboi From your code I can't immediately see why the code does not work but instead of trying to use a global variable for Session why do you not return it from the authenticate_user function after yield and pass that in so that it can be used to connect the socket?

finally got it working i restarted everything and just made a new project overall, thanks for ur effort to help are u one of the nakama developers? good job with this module it makes everything to do with multiplayer 200 times easier im still impressed with the server storage mechanism, thanks for helping