{"id":19075423,"url":"https://github.com/aerecurax/Java-Websockect-BetGame","last_synced_at":"2026-05-20T05:30:15.576Z","repository":{"id":123480811,"uuid":"540213159","full_name":"developersunesis/Java-Websockect-BetGame","owner":"developersunesis","description":"A backend service for guess the number game using WebSocket for communication","archived":false,"fork":false,"pushed_at":"2022-10-01T11:04:34.000Z","size":1210,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T04:43:57.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developersunesis.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-23T00:01:41.000Z","updated_at":"2023-07-01T17:44:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"0443e329-63a6-47e6-8518-f8564e3648af","html_url":"https://github.com/developersunesis/Java-Websockect-BetGame","commit_stats":null,"previous_names":["developersunesis/java-websockect-betgame"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developersunesis%2FJava-Websockect-BetGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developersunesis%2FJava-Websockect-BetGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developersunesis%2FJava-Websockect-BetGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developersunesis%2FJava-Websockect-BetGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developersunesis","download_url":"https://codeload.github.com/developersunesis/Java-Websockect-BetGame/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240127088,"owners_count":19751938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T01:54:38.190Z","updated_at":"2026-05-20T05:30:15.476Z","avatar_url":"https://github.com/developersunesis.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GuessTheNumber Game\n\n### Overview\n\nA guess the number game using WebSocket communication in SpringBoot. The application\nrecursively starts a game session and allows players to place a bet in the active game\nwithin a specific time bound (10 seconds). After the game time has elapsed, that is, the\ntime allowed to place bets, the application generates a random number and awards all bets\nthat matches the number it generates.\n\n![Web Interface](imgs/app_interface.png)\n\n### Core functionalities\n\n- The server start a game round recursively and gives 10 seconds for players to place a bet\n- After the time elapse, every play receives a feedback from the game and a summary as seen above\n- Players who WON in the round are given a feedback and awarded 9.9 times the stake placed in the bet\n- Players who LOST are given a feedback of their loss\n- New game rounds are started immediately after the previous game ends\n\n## Install\n\n#### Installation Requirements\n\n- Java 11 or above\n- Gradle\n- Spring Boot\n\n#### Steps\n\n- Clone the repository\n- Load the dependencies `./gradlew clean`\n- Run the application `./gradlew bootRun`\n\n\n- The application runs on port `:8080` therefore, you can access its user interface locally on http://localhost:8080\n\n\n- The socket communication is handled by `GameSocketHandler` class and exposed under `/guessTheNumberGame` path.\n  Communication between the client and server follow the message format below\n\n#### Server/Client message format\n\n```\n{\n  \"type\": \"PING\",\n  \"data\": {...},\n  \"message\": null\n}\n```\n\n## Testing\n\nUnit and integration tests were added to the implementation with a coverage of over 80%. Report information can\nbe found in the **reports** folder.\n\n#### Running Tests\n\n`./gradlew test`\n\nTests take about 12-25s to complete\n\n### Side Notes\n\n- The test case `fivePlayerSuccessfullyPlacesBetForActiveGameAndGotFeedback` can be a bottleneck due to its wait time\n  and proper mocking can be done to improve this so that scheduling does not need to happen. Nevertheless, it provides\n  a good process to simulate an actual game round at this point\n- Handler class functionality can be separated from the message functions needed to send a message to clients\n- Currencies were not catered for in the betting process, this can be considered as an improvement\n- Improved security can be done, to ensure unauthorised access is restricted in communication with the service\n- Several improvements can be done for the UI/UX to ensure that the game process is easier from a customer's perspective\n- Convert all JavaScript functions to non-blocking functions using Promise","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerecurax%2FJava-Websockect-BetGame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faerecurax%2FJava-Websockect-BetGame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerecurax%2FJava-Websockect-BetGame/lists"}