A real time multiplayer functionality was added to the classic snake game using a web Socket npm package dependency called socket.io. The game was developed using pure Javascript with Node JS as the game server. The game is multiplayer and therefore uses the socket.io library to establish a connection handshake between players (clients) and the server, keeping the http request open for the duration of the game.
The Socket.io library is the main piece of the whole puzzle. A Javascript library that enables multiplayer functionality in real time and provides persistent connection between client and server.It is responsible for keeping the HTTP Request to the node server and listens for connection based on data passed through identities known as messages. It uses web sockets for creating a client/server structure to enable real time exchange of data. Most commonly used for Chat Applications.
Clone the repository and install the dependencies by running
npm install
Run the Application
npm start
Go directly to the website here snakerace.herokuapp.com
The foundational snake game codebase was forked from
This application was deployed on Heroku: A PaaS (Platform as a Service) web application deployment manager.
- JavaScript
- Bootstrap
- Node JS
- Socket.io