npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kontest/gamelift-pb

v0.1.8

Published

NodeJS addon for Protocol Buffer objects used in AWS Gamelift

Downloads

10

Readme

gamelift-pb

Build Status codecov Known Vulnerabilities

Protocol Buffer messages used in the AWS GameLift Server SDK usable in a NodeJS environment.

This library enables communication between a NodeJS process and the AWS GameLift service.

API Documentation

Getting Started

These message definitions aren't meant to be used directly. Head over to @kontest/gamelift for a guide and examples on how to get started with a NodeJS server running on AWS GameLift.

Development

This library contains Protocol Buffer definitions implemented in TypeScript & protobuf.js reflection capability.

Motivation

The AWS GameLift Server SDK doesn't include the original .proto files which define the Protocol Buffer messages used for communication between a dedicated game server and the GameLift service. In order to utilize the messages from a NodeJS environment there are a few options:

  1. Create a NodeJS C++ addon with some "glue" using the N-API to traverse the C++/NodeJS language barrier.
  • There are other ways of implementing the specifics of this; N-API isn't specifically required. But all such solutions would require native "glue" code between NodeJS and Protocol Buffer messages compiled by protoc so that they're usable from JavaScript.
  1. Recreate the message definitions in a way that NodeJS can use without touching native code.
  • This could entail writing out the .proto files themselves and using protoc to generate NodeJS code, defining them with protobuf.js's reflection capability, or any other method for re-creating the messages in JavaScript.

I chose (2) over (1) for the following reasons:

  • Easier to deploy: When you start deploying native code you have to build for multiple platforms.

  • Inline documentation & type safety: Using TypeScript is advantageous since TypeDoc can be used to easily generate documentation. Static type checking with TypeScript is also an advantage.

    • Native code could be written while getting the benefits of TypeScript with a declaration file. However, writing TypeScript in the first place reduces the amount of code to write.
  • Easier to extend: AWS GameLift SDK includes some model definitions which provides some helper methods on top of the fields already present in the Protocol Buffer messages. Using protobuf.js decorator's capability, the classes in this library fully implement GameLift's message definitions while still being as extendable as any class in JavaScript.

Contributing

The following guide describes how to get setup for testing and working on gamelift-pb.

Requirements:

In order to successfully fix bugs or add new features to this library you'll need to be able to run the test suite. Since the only reference for these Protocol Buffer messages are the original C++ class definitions generated by protoc the test functions & assertions are mainly written in C++. This implies a toolchain is required that is capable of building native code for your development environment.

The build tool this project interfaces with directly is cmake-js. You'll also need to install CMake itself. This project has only been tested with CMake version 3.16. Other versions will probably work, but they are not tested.

A C/C++ compiler for your platform is also required. See the cmake-js project's README.md for some links on where to acquire those tools.

The rest of the development dependencies can be conveniently installed like any other NodeJS project:

$ npm install

Or with yarn

$ yarn install

Testing

This project utilizes Mocha.js as its test runner. Simply run npm test.

This will run the pretest script first which should build the C++ addon used in the tests with cmake-js. mocha will then run the test suite defined in TypeScript files found in tests directory.

Linting

This project utilizes eslint for code quality. The script to run to lint your changes is npm run lint.

Formatting

prettier is used for formatting TypeScript and clang-format can be used for formatting the C++ code found in the tests. You can use the tools respectively with npm run format and npm run format:test.

Generating documentation

To generate the user-visible documentation run npm run docs. The generated docs are very stripped down and only include the messages that should outside of the GameLift SDK in most scenarios.

To generate more developer-friendly documenation you can run npm run docs:internal. The previously mentioned stripped internal members are included in the output.