Enjoy the game of rock paper scissors from anywhere online with your friends and strangers. View the project live here.
- Completely responsive-Works on any device.
- Interactive and fun- with animations and more.
- Cross browser support.
Client: React, Sass
Server: Node, Express, WebSocket, Socket.io
- After getting connected to the socket server, user is asked to enter a username. If the username is unique than the user will be taken to the game else will be asked again for a different username.
- Here user can send request to any player from the active players section or can accept/reject the request itself.
- when the other user accepts the request, the game get started between them.
- User select his choice b/w rock, paper and scissors and that choice cannot be seen by other player until both player make choices.
- Both player will play 5 rounds of the game and the winner will be declared accordingly.
- If in any case the user quits the game or gets disconnected from the server, the game automatically ends on both sides telling the user of what happened.
There are two branches two this project, one is implemented over WebSocket library of node.js and other uses Socket.io for web socket server client communication.
- web-socket This branch is implemented over the WebSocket library which is completely reliable on socket connections which is why it is difficult for me to deploy it over production as it is not allowed either to connect to ws protocol over https protocol or to create https server myself and run it over internet.
- main This branch is implemented over the Socket.io connection which uses communicates through sockets primarily but if it fails to, then it fallbacks to http polling. currently this project is using ws connection only locally and globally it uses http polling.
Clone the project
git clone https://github.com/rohitmirchandani/rock-paper-scissors-online
Go to the project directory
cd rock-paper-scissors-online
Install dependencies
npm install
Start the server
node server.js
Start the client
cd client
npm run start
- The app should work on web socket protocol in production also and use http polling as a fallback option.
- Although the app is mobile is mobile responsive, It cannot connect to server on cellular networks. This is due to the Socket.io library and might be fixed through updates in future.
For feedback, email [email protected].