Hello.
I want to use Nakama as a game server. but the client is codded in AS3 (Air).
I found no SDK in As3, so it seems I have two options. Rest And Sockets.
how can I connect to Nakama server through socket?
is it possible without a client SDK?
Hello.
I want to use Nakama as a game server. but the client is codded in AS3 (Air).
I found no SDK in As3, so it seems I have two options. Rest And Sockets.
how can I connect to Nakama server through socket?
is it possible without a client SDK?
Hi @ArmanBM welcome
I didn’t know development continued with ActionScript3 (Adobe Air) games. You can connect direct to a socket if you have a WebSocket client which you can use from the Air runtime with a session token. Have a look at this part of the .NET code:
https://github.com/heroiclabs/nakama-dotnet/blob/master/src/Nakama/WebSocketAdapter.cs#L91-L135
We don’t do anything proprietary within our client SDKs its all open-source.
Hope it helps.
Tanks, it definitely helps.
what should I pass as “url” in snipped code? is it “127.0.0.1” (root) or somewhere else?
how can I know the list of available commands? for example authentication through socket?
or updating player coins?
what should I pass as “url” in snipped code? is it “127.0.0.1” (root) or somewhere else?
The client is open-source so you can see the URL construction in the code:
https://github.com/heroiclabs/nakama-dotnet/blob/master/src/Nakama/Socket.cs#L497-L508
how can I know the list of available commands?
You can see the realtime protocol defined here:
https://github.com/heroiclabs/nakama-common/blob/master/rtapi/realtime.proto
You can also read the documentation of the server which covers all the realtime features in detail.
for example authentication through socket? or updating player coins?
You don’t authenticate over the socket but via the REST/GRPC API. Have a look at the code for how to obtain a session token:
https://github.com/heroiclabs/nakama-dotnet/blob/master/src/Nakama/ApiClient.gen.cs#L3423-L3465
Thanks for the complete reply.
Flash Rest API does not support Authentication in the header!
Is there any other way for me to use authentication using AS3?
Is there any other way for me to use authentication using AS3?
Sadly, no. There’s no other way to authenticate with the game server because we rely on using standard HTTP headers for both "Bearer"
and "Basic"
auth as a way to authenticate and authorize the request.
Is there a reason you still develop games with AS3? Could you not move to a newer engine or toolchain?
it supports it, I already have an adobe air(AS3) project and I’m using the Bearer token in the header!
also if you have a flash project you can use Smartfox Server ,