Giter Site home page Giter Site logo

aws-gamelift-server-sdk-rs's Introduction

AWS GameLift Server SDK for Rust

Docs Build Status Badge License

What

An unofficial port of AWS GameLift Server SDK for Rust.

How to build

  1. Install the latest stable Rust toolchain

  2. Checkout this repository and change directory to the root

  3. cargo build

Compatibility

This crate is compatible with 4.0.2 AWS GameLift Server SDK. We support the latest stable Rust version.

Contributing

If you find any bug, missed functionality or just want to share any feedback - feel free to open an issue. Will be wonderful, if you create a PR - it makes my life much easier.

Testing

You can test the library directly on AWS GameLift service, but it can be too slow and expensive for you. I suggest to you official AWS GameLift Local. Unfortunately, for now AWS doesn’t provide any official Docker image for the local server, so you can use my Docker image. The original repo is here. Just run your local server and run any application with the SDK (any example is fine too).

Architecture

Now there are 2 official AWS GameLift Server SDK versions: C and C#. They look pretty similar, but under the hood they work differently. Even versioning is different for them. At the moment of writing this, C SDK had 3.4.1 version, C# had 4.0.2 version and they had different Protobuf backward-compatible schema.

C++ SDK uses 2 Socket.io connections to the AWS GameLift Server process on a node (this process’s name is AuxProxy). The first connection is used for sending requests from the SDK to AuxProxy and receiving the answers (request-response pattern). The second connection is used for receiving events from AuxProxy.

C# SDK uses another approach. It uses HTTP protocol for implementing request-response pattern and raw WebSocket connection for receiving the events from AuxProxy.

Initially this library (AWS GameLift Server SDK in Rust) tried to use the C++ approach with 2 Socket.io connections. Unfortunately, I’ve failed to implement it properly for several reasons. Request-response pattern with Socket.io looks ugly. Socket.io library in Rust is too young and unstable from my point of view (I’ve tried to use rust-socketio).

So the way with HTTP + WebSocket was chosen as a primary design - I just like it more, and it was easier for me to properly implement the SDK in this way. If you have any concerns about usability, efficiency or anything else - please let me know!

Protobuf schema

AWS GameLift Server SDK uses Protobuf 3 protocol. Unfortunately, AWS doesn’t provide officially original Protobuf files yet. So we use reverse-engineered .proto files from this repository: Protobuf schema. Since the original repo can be outdated, I also maintain my own fork (any help with maintaining is appreciated a lot): Another Protobuf schema.

Notes

If you are looking for AWS GameLift SDK (without Server word) - this crate is not for you. Please use rusoto, or an official AWS Rust SDK (at the moment of writing this GameLift is not supported in this SDK).

  1. AWSGAMETECH forum thread about differences between SDK and semi-official Protobuf schema

  2. Unofficial NodeJS AWS GameLift Server SDK

aws-gamelift-server-sdk-rs's People

Contributors

luminoth avatar zamazan4ik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

b-head

aws-gamelift-server-sdk-rs's Issues

Deadlock when calling Api methods from callbacks

From the basic.rs:

            on_start_game_session: Box::new(move |game_session| {
                Box::pin(async move {
                    log::debug!("{:?}", game_session);

                    CLIENT
                        .lock()
                        .await
                        .activate_game_session()
                        .await
                        .expect("Cannot activate game session");

                    log::info!("session activated!");
                })
            }),

the call to activate_game_session() does this:

let game_session_id = self.inner.lock().await.game_session_id.clone();

that inner lock is already being held here in perform_connect():

                        ReceivedMessageType::ActivateGameSession(message) => {
                            log::info!("Received ActivateGameSession event");
                            callback_handler
                                .lock()
                                .await
                                .on_start_game_session(message.game_session)
                                .await;
                        }

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.