Giter VIP home page Giter VIP logo

nakama_rpc's Introduction

Nakama RPC

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

Current RPC functions available

  • Wallet
  • Health Check

How to use

To use the RPC as it is (without any changes) follow the instructions below

  1. copy the index.js in the build folder
  2. paste the index.js file in the module folder in your nakama folder
  3. 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

Wallet RPC

The source code for this function is found in backend/walletupdate.ts. Feel free to edit it as you wish.

Note:

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

using wallet in API Expolorer

  1. find the walletupdate function in the api explorer
  2. Paste the user id in the 'user id request form'
  3. add the payload
    {
    "token": -25
    }
    
  4. Click on the send request button
  5. on sucessful update of the wallet it returns
    {
    "title": "successful",
    "data": {
        "token": -25
    }
    }
    
  6. you have sucessfully updated your wallet token

Health Check RPC

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.

using wallet in API Expolorer

  1. find the healthcheck function in the api explorer
  2. Paste the user id in the 'user id request form'
  3. Click on the send request button
  4. the successful message is shown on the screen

Screenshots

Wallet RPC request

nakama_rpc's People

Contributors

anthonyaniobi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

backendgames

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.