( xxx ) ้ฝๆฏ้กๅค็ๅ่ฝ
-
User ๅ ไปฅๆๆ็จๆถ ( ๆๆ้ๅๅ DB , ่ผธๅ ฅไฝฟ็จ่ ๅ็จฑ๏ผuniqe id )
-
WASD ็งปๅ
-
้ ญไธๅๆณกๆณก่จๆฏ๏ผ ๅณ้ไธๅๅดๆฌ ๆๅญ ๏ผ ่ฒผๅ ๏ผ
-
ๆๅก๏ผ ๅบ็พไธๅ็ด ้ป ้กไผผ Google map ไธๆจฃ้้ๅณ้ๅดๆฌ ๅบๅฎถ ๆๆๆธ ่ท้ข ๏ผ ๅไบซ่ณ่จ ๏ผ
username
: struserId
: uuid4 ( fromutils
)
-
Client to backend :
- interface :
{ 'event':'xxx' , .... }
event
:new_user
move
message
check_in
- new_user :
{ 'event':'new_user' , 'username' : 'jason' }
- move :
{ 'event':'move', 'pos' : [ 11.15,22.21 ] }
- message :
{ 'event':'message', 'message' : 'Hi all!' }
- check_in :
{ 'event':'check_in', 'pos' : [65.12,304.3], 'img' : 'image_url' , 'content' : 'Lunch :p', 'created_at': '2020-04-0 12:00:00' }
- interface :
-
Backend to client :
event
:update
message
check_in
- update
- { 'event':'update' , 'username': 'jason', 'pos' : [11.22, 33.44] }
- message
- { 'event':'message' , 'username': 'jason', 'pos' : [11.22, 33.44], message: 'Hi all!' }
- check_in
- {'event': 'check_in', 'id': 'twjet-wrqwrwqe', 'user_id': 'fwefwe34wre', 'username': 'jason', 'pos': [11.22, 33.44], 'img': 'image_url', 'content': 'Lunch :p', 'created_at': '2020-04-0 12:00:00''}
class userModel(TypedDict):
id: Union[str, int]
username: str
pos: Tuple[float, float]
message: str
// TBD
TBD : Is mySelf state necessary ?
-
myself
: dict{ 'user' : 'ouo' , 'pos' : [11.22,33.44]}
-
users
: dict{ 'jason' , { 'pos' : [12.3,3.21] } , 'ouob' , { 'pos' : [12.3,3.21] }, }
-
checkIn
: list[ { 'user' : 'jason', 'pos' : [11.22,33.44] , 'img' : 'image_url' , 'content' : 'Save water for beer!' } , { 'user' : 'OuO', 'pos' : [11.22,33.44] , 'img' : 'image_url' , 'content' : 'ouo' } , ]
- map
- websocket