Code Monkey home page Code Monkey logo

io.autometa.lobby's Introduction

Io.Autometa.Lobby

Lightweight RESTful lobby service that supports different games simultaneously backed by Redis. It functions similarly to the JackBox game lobby, but has additional (optional) features. You'd use this service to allow game clients to locate game servers hosted by peers.

API

Swagger exposes the API; rely on it instead of documentation which may be out of date. You can also check out the API controller.

Create

Create a lobby for the "gitgame" game:

curl -H "Content-Type: application/json" -X POST -d '{"port":6969,"name":"host nickname","hidden":false,"meta":{}}' https://lobby.autometa.io/api/gitgame

This can be extended with metadata:

curl -H "Content-Type: application/json" -X POST -d '{"port":6969,"name":"host nickname","hidden":false,"meta":{"metakey1":"metavalue1","metakey2":"metavalue2"}}' https://lobby.autometa.io/api/gitgame

Search

Look for lobbies for the "gitgame" game:

curl -H "Content-Type: application/json" https://lobby.autometa.io/api/gitgame

Search results can be further filtered by metadata.

Refresh/Read

Lobbies that are not called for a time are dropped. Call this method to refresh the TTL. This is for a lobby with an ID of "2KQPG" for the "gitgame" game.

curl -H "Content-Type: application/json" https://lobby.autometa.io/api/gitgame/2KQPG

Join Lobby

Join a lobby as a player named "player1", declaring a desire to use port 7000. This isn't technically necessary to use the service.

curl -H "Content-Type: application/json" -X POST https://lobby.autometa.io/api/gitgame/2KQPG/player1?port=7000

Leave/Kick/Destroy Lobby

This method is overloaded. If the caller is the host, they can kick any player. If they kick themself, the lobby is destroyed. If the caller is not the host, they may only kick themself. This isn't technically necessary to use the service.

curl -H "Content-Type: application/json" -X DELETE https://lobby.autometa.io/api/gitgame/2KQPG/player1

Configuration for AWS

  1. Create a Redis ElastiCache server.
  2. Set up an AWS Lambda function targetting Io.Autometa.Lobby.Server::Io.Autometa.Lobby.Server.Gateway::FunctionHandler. Set the ElasticacheConnectionString environment variable on it to point to the Redis server. Give it permissions to access the Redis server.
  3. Set up an API Gateway to point to the Lambda function. It should be set up in proxy mode, since the same function will handle all paths.
  4. Set up an external DNS in AWS and point it to the API Gateway.

TODO: Make this all automatic on publish.

Configuration for Local Execution

See the integration test for an example.

Attribution

  1. StackExchange/StackExchange.Redis
  2. neuecc/RespClient

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.