Draft v3.0.
Would be transferred to webpages with django-rest-framework after revisions.
-
POST/login -
GET/logout -
POST/register
-
User login.
{ "password":"12345", "username":"WWWlab" } -
User log out
-
User sign up.
{ "email":"abc@seu.edu.cn", "first_name":"abc", "last_name":"def", "username":"WWWlab", "password":"12345" }
-
POST/game/{GameTypeID}/create-new-game-room/ -
POST/game/{GameID}/ -
GET/game/{GameID}/ -
POST/game/{GameID}/record/ -
GET/game/{GameID}/record/
-
Create a new game room with user's port and gametype GameID, return the generated room number. Login required.
{ "port":"1234", }
-
Join a new game. Login required.
Need further implementation when interacting with game server.
-
Get the status of game with id = {GameID}
Return the game record in JSON if the game is over.
Example:
{ "game.status": "1", "game.owner": "WWWlab", "game.created_time": "2018-07-18T03:00:28.771623+00:00" }
-
If the game is on, send user's current decision on the game to back end.
Use operation ID to determine what kind of operation is being performed.
For default, ID = 0.
-
Return the whole record of the game with ID {gameID} till the current time.
-
前端收到房主请求,调用后端CreateNewGameRoomAPI
POST(req,GameTypeID)返回新游戏id,房主自动加入新游戏
-
前端显示新房间情况,调用后端
GameInfoAPI(req,GameID)Post:
将post的用户加入新房间,
若用户满足开启游戏条件则向服务器发消息
GET:
显示当前房间信息
{ 'game.status':... 'game.created_time':... 'game.players':... }