Attention, les données contenue dans data doivent être convertis en base64 et mis en tant que string en tant que value pour data
Si le client envois un callbackId lors d'une requête, il sera aussi présent dans la réponse. Les messages Broadcasté par le serveur comme les messages de type Refresh n'ont pas de callbackId
Attention, Si vous êtes en mode demo, à la fin d'une partie vous serez renvoyé à l'état start, si vous êtes authentifié et avez démarré la game depuis un lobby vous serez renvoyé dans l'état home.
{"type":"Fetch","dataType":"","data":null, "callbackId":""}
{"type":"Fetch","dataType":"Board","data":"myBase64Data", "callbackId":""}
{"type":"FetchPlayer","dataType":"","data":null, "callbackId":""}
{"type":"FetchPlayer","dataType":"Player","data":"myBase64Data", "callbackId":""}
{"type":"FetchPlayerRefused","dataType":"","data":", "callbackId":""}
{"type":"PlacePiece","dataType":"Piece","data":"myBase64Data", "callbackId":""}
myBase64Data => {"id":18,"cubes":[{"X":0,"Y":0},{"X":0,"Y":1},{"X":1,"Y":1},{"X":2,"Y":1},{"X":2,"Y":2}],"origin":{"X":10,"Y":10,"playerId":null},"rotation":"N","flipped":false,"playerId":0}
{"type":"PlacementConfirmed","dataType":"","data":null, "callbackId":""}
{"type":"PlacementRefused","dataType":"","data":null, "callbackId":""}
{"type":"PlaceRandom","dataType":"","data":null, "callbackId":""}
{"type":"Refresh","dataType":"Board","data":"myBase64Data", "callbackId":""}
{"type":"GameOver","dataType":"","data":null, "callbackId":""}
{"type":"Concede","dataType":"","data":null, "callbackId":""}
{"type":"Quit","dataType":"","data":null, "callbackId":""}
{"type":"Quit","dataType":"","data":null, "callbackId":""}
{"type":"FetchClient","dataType":"","data":null, "callbackId":""}
=> {"type":"FetchClient","dataType":"Client","data":"myBase64Data","callbackId":""} | myBase64Data : {"id":0}
{"type":"DestroyClient","dataType":"","data":null, "callbackId":""}
Envoyé :
{"type":"BroadcastMessage","dataType":"Message","data":"myBase64Data", "callbackId":""}
myBase64Data => { "message":"MyMessage" }
{"type":"SendMessage","dataType":"Message","data":"myBase64Data", "callbackId":""}
myBase64Data => { "message":"MyMessage", "recipientId":0 }
Broadcast reçu :
{"type":"BroadcastMessage","dataType":"Message","data":"myBase64Data", "callbackId":""}
myBase64Data => {"clientId":0, "hubId":0, "holderType":"myType", "holderId":0, "message":"MyMessage"}
{"type":"SendMessage","dataType":"Message","data":"myBase64Data", "callbackId":""}
myBase64Data => {"clientId":0, "hubId":0, "holderType":"myType", "holderId":0, "message":"MyMessage"}
{"type":"CreateDemo","dataType":"","data":null, "callbackId":""}
{"type":"Authenticate","dataType":"string","data":"myBase64Data", "callbackId":""}
myBase64token => {"player_id": 123, "access-token": "myAccessToken", "client": "MyClientToken"}
{"type":"Disconnect","dataType":"","data":"", "callbackId":""}
{"type":"CreateLobby","dataType":"","data":null, "callbackId":""}
{"type":"JoinLobby","dataType":"int","data":"myInt", "callbackId":""}
=> {"type":"JoinLobbyConfirmed","dataType":"","data":null, "callbackId":""}
=> {"type":"JoinLobbyRefused","dataType":"","data":null, "callbackId":""}
{"type":"ObserveGame","dataType":"int","data":"myInt", "callbackId":""}
{"type":"Broadcast","dataType":"ListLobby","data":"myBase64Data", "callbackId":""}
=> {"lobbies":[{"Id":0,"Name":"TEST","clients":[{}],"Master":{},"seats":{}}]}
{"type":"Broadcast","dataType":"ListGame","data":"myBase64Data", "callbackId":""}
{"type":"Broadcast","dataType":"ListClient","data":"myBase64Data", "callbackId":""}
{"type":"Invitation","dataType":"","data":"myBase64Data", "callbackId":""} => demande et reception d'invitation
myBase64Data => { "sender" : {"id": 1}, "recipient": {"id": 2}, "lobby": {"id": 3} }
{"type":"InvitationFailed","dataType":"","data":"myBase64Data", "callbackId":""}
{"type":"Start","dataType":"","data":null, "callbackId":""} => Attention seul le Master peut démarre la partie
{"type":"FetchLobby","dataType":"Lobby","data":myBase64Data, "callbackId":""} | myBase64Data : {"id":0,"name":"TEST","clients":[{"id":1}],"master":{"id":1},"seats":{"1":{"id":0}}}
=> dans cet exemple le client 1 est le master et est assis sur le siège numéro 1
=> NB : Un Client avec un id 0 est toujours un AI, les vrais client ont un id égale ou supérieur à 1
{"type":"Sit","dataType":"int","data":"myInt", "callbackId":""}
{"type":"Unsit","dataType":"int","data":"myInt", "callbackId":""}
{"type":"SitAI","dataType":"int","data":"myInt", "callbackId":""} => Attention seul le Master peut utiliser cette commande
{"type":"UnsitAI","dataType":"int","data":"myInt", "callbackId":""} => Attention seul le Master peut utiliser cette commande
{"type":"SetAiEasy","dataType":"int","data":"myInt", "callbackId":""} => Attention seul le Master peut utiliser cette commande
{"type":"SetAiMedium","dataType":"int","data":"myInt", "callbackId":""} => Attention seul le Master peut utiliser cette commande
{"type":"Quit","dataType":"","data":null, "callbackId":""}
myInt => "myInt" | => 0 : "MA==", 1 : "MQ==", 2 : "Mg==", 3 : "Mw=="
{"type":"Start","dataType":"","data":null, "callbackId":""}