This is a script for generating Remote Procedure Calls in nakama.
This project was inspired by my need to update wallet details in nakama. The wallet can only be updated using RPC calls which can be triggered by the client. You can work with the RPC calls using the nakama api explorer
- Wallet
- Health Check
To use the RPC as it is (without any changes) follow the instructions below
- copy the
index.js
in the build folder - paste the index.js file in the module folder in your nakama folder
- you can start the nakama server as usual
If you would like to make some changes to the RPC, read the instructions below and then run the command:
sudo docker-compose up
this generates the build/index.js
file
using this file repeat the instructions above
The source code for this function is found in backend/walletupdate.ts
. Feel free to edit it as you wish.
while editing the wallet RPC note that the changeset
contains data that would be sent to the wallet data storage.
The current file uses a token for wallet data
- find the walletupdate function in the api explorer
- Paste the user id in the 'user id request form'
- add the payload
{ "token": -25 }
- Click on the send request button
- on sucessful update of the wallet it returns
{ "title": "successful", "data": { "token": -25 } }
- you have sucessfully updated your wallet token
This is a sample RPC created by Heroic Labs. This is a simple RPC that does not take any input, but returns a json on sucessful implementation. The sucess message is shown below
{
"success": true
}
You can update the healthcheck code and it can be found in backend/healthcheck.ts
.
- find the healthcheck function in the api explorer
- Paste the user id in the 'user id request form'
- Click on the send request button
- the successful message is shown on the screen