Giter VIP home page Giter VIP logo

2021-frontend-wss's Introduction

2021-frontend-wss

Simple WebSocket server that can be used for client development.

Requirements

  • Node.js v14.3
  • npm 6.14

Usage

All Services in Dev Mode TDLR

First, get the 3 necessary services running:

git clone https://github.com/rhdemo/2021-frontend-wss
git clone https://github.com/rhdemo/2021-admin-hq
git clone https://github.com/rhdemo/2021-frontend-css-html
git clone https://github.com/rhdemo/2021-ai-agent-server

# Start the infinispan server and game websocket server
cd 2021-frontend-wss
./scripts/infinispan/infinispan-docker-compose/infinispan.start.sh
./scripts/node.sh

# Start the AI Agent service (in another terminal)
cd 2021-ai-agent-server
./scripts/node.sh

# Start the Admin HQ (in another terminal)
cd 2021-admin-hq
./scripts/node.sh

# Start the UI service (in another terminal)
cd 2021-frontend-css-html
npm i -g yarn
yarn install
yarn start

Open http://localhost:3001 (the Admin UI), and click the Play button.

Next, open up http://localhost:3002 in two separate browsers, or in a regular and incognito/private browsing session - this allows you to play as two players against each other on one machine!

To play against an AI opponent open the Game UI with this querystring http://localhost:3002/?useAiOpponent=true.

Controlling the WSS Server Game State

Use the Admin HQ Web UI to change the game state. You must select Play to make attacks in the game.

Run in Dev Mode

Making changes to the TypeScript source code under the src/ dir after running the commands below will cause the Node.js server to automatically restart with the new changes.

NOTE: Both Infinispan and the Node.js run on a specific Docker network to facilitate communication. This is because Infinispan has some tricky networking behaviours to deal with when running in the Docker VM on macOS.

git clone https://github.com/rhdemo/2021-frontend-wss
cd 2021-frontend-wss

# Setup the inifispan server
./scripts/infinispan/infinispan-docker-compose/infinispan.start.sh

# Start the node server with live reload
./scripts/node/node.start.sh

Run in Production Mode

git clone https://github.com/rhdemo/2021-frontend-wss
cd 2021-frontend-wss

npm install
npm build
npm start

Simulating a Player/Client

Refer to the client-sim/ folder.

Endpoints

HTTP

  • GET /health - Returns a 200 response with application health information

WebSocket

  • /game - Endpoint that game clients connect to.

2021-frontend-wss's People

Contributors

evanshortiss avatar karesti avatar kylebuch8 avatar sub-mod avatar

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.