3 releases (breaking)

0.3.0 Jan 16, 2022
0.2.0 Jan 6, 2022
0.1.0 Jun 12, 2021

#133 in #status

MIT license

81KB
1K SLoC

AWS GameLift Server SDK for Rust

// URIs: :uri-docs: https://docs.rs/aws-gamelift-server-sdk-rs :img-docs: https://docs.rs/aws-gamelift-server-sdk-rs/badge.svg :uri-build-status: https://github.com/zamazan4ik/aws-gamelift-server-sdk-rs/actions :img-build-status: https://github.com/zamazan4ik/aws-gamelift-server-sdk-rs/workflows/Continuous%20integration/badge.svg :uri-license: https://github.com/zamazan4ik/aws-gamelift-server-sdk-rs/blob/main/LICENSE :img-license: https://img.shields.io/badge/License-MIT-blue.svg

Docs,link={uri-docs} Build Status Badge,link={uri-build-status} License,link={uri-license}

ifdef::env-github[] ++++

++++ endif::[]

ifndef::env-github[] A map, 300, align=center endif::[]

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

Dependencies

~10–22MB
~327K SLoC