Repository navigation
Home
Zacky edited this page Mar 18, 2017
·
5 revisions

- Nginx
proxy_passshould be configured according touser_id. -
GameLordservice should deployed to several pods, and the containers in a pod run the instance. -
Redisholds hashed users' tokens.

- Users get
login_tokenby/sign_upor/login. When it expires or/logoutby yourself, you need/loginagain. - Users get
game_tokenby/load_game. When it expires or/leave_gameby yourself, you need/load_gameagain. - Take
Hangmanas an example:- If you start to play
hangmanfor the first time, you should/list_categoryand/pick_wordfor initialization. - If you have played
hangmanbefore, you shouldload_statusto continue. - Every time you
/validateyour selected letter, you will get thecurrent_word. And you will be told whether it's over. - During the game, you can
resetanytime. Once youleave_game, yourgame_statuswill be saved automatically.
- If you start to play
| Type | Generation |
|---|---|
| login_token_key | Sha1Hash("[user.Salt][user.Id][CurrentDevice]") |
| login_token_value | Sha1Hash("[user.Salt][time.Now") |
| game_token_key | Sha1Hash("[user.Salt][user.Id][game.Id][CurrentDevice]") |
| game_token_value | Sha1Hash("[user.Salt][time.Now") |
| Code | Overview |
|---|---|
| 10[1-9] | Common Error |
| 11[1-9] | User Error |
| 12[1-9] | Game Error |
| 13[1-9] | Hangman Error |
| Code | MessageType | Detail |
|---|---|---|
| 101 | err_internal | Internal Error |
| 102 | err_missing_data | Missing API Data |
| 103 | err_invalid_data | Invalid API Data |
| 110 | user_success | User Request Succeed |
| 111 | err_duplicate_name | Duplicate User Name |
| 112 | err_user_not_exist | User Name Doesn't Exist |
| 113 | err_password_mismatch | Password Mismatch |
| 114 | err_login_token_mismatch | Login Token Mismatch |
| 115 | err_game_token_mismatch | Game Token Mismatch |
| 121 | err_game_not_exist | Game Doesn't Exist |
| 130 | hangman_success | Hangman Request Succeed |
| 131 | err_user_record_not_exist | User Record Doesn't Exist |
| Name | Method | Pattern | Notes |
|---|---|---|---|
| Signup | POST | /v1/signup | get login_token
|
| Login | POST | /v1/login | get login_token
|
| Logout | POST | /v1/logout | lose login_token
|
| LoadGame | POST | /v1/load_game | get game_token
|
| LeaveGame | POST | /v1/leave_game | lose game_token
|
- About data format, plz see more at
gameLordReq/Resp file.
| Name | Method | Pattern |
|---|---|---|
| ListCategory | POST | /v1/hangman/list_category |
| PickWord | POST | /v1/hangman/pick_word |
| LoadStatus | POST | /v1/hangman/load_status |
| Validate | POST | /v1/hangman/validate |
| Reset | POST | /v1/hangman/reset |
- About data format, plz see more at
hangmanReq/Resp file.