Village message protocol examples
Server-to-logger message examples
Server-to-client morning.jsonld
-
[before] morning.jsonld
-
[after] morningForLog.jsonld
Server-to-client myMessageOnChat.jsonld
-
[before] myMessageOnChat.jsonld
-
[after] myMessageOnChatForLog.jsonld
Client-to-server nightVote.jsonld
-
[before] nightVote.jsonld
-
[after] nightVoteForLog.jsonld
Receipt system
Once a robot/browser receives a chat message,
-
(client to server) receivedChatMessage.json
Once a robot/browser receives a flavor test message,
-
(client to server) receivedFlavorTextMessage.json
Once a robot/browser receives a systemMessage,
-
(client to server) receivedSystemMessage.json
Finalization flow
A host player starts the next game
-
push the "Next game" button
-
(client to server) villageMessage/ buildVillage.json
-
(server to all the clients) villageMessage/ nextGameInvitation.json
-
save a next game village id in the indexeddb
-
move from villageMessage to lobbyMessage
-
(client to server) lobbyMessage/ selectVillage.json
-
(server to client) lobbyMessage/ waitingPage.json
-
remove the next game village id in the indexeddb
-
push the "Play" button
-
(client to server) lobbyMessage/ play.json
-
(server to client) lobbyMessage/ played.json
-
move lobbyMessage to villageMessage
-
(client to server) villageMessage/ ready.json
-
(server to other clients) villageMessage/ nextGameInvitaionIsClosed.json
-
(other clients) undisplay the "Next game" button
A guest player joins the next game
-
(server to all the clients) villageMessage/ nextGameInvitation.json
-
save a next game village id in the indexeddb
-
move villageMessage to lobbyMessage
-
display the "Next game" button
-
push the "Next game" button
-
(client to server) lobbyMessage/ selectVillage.json
-
(server to client) lobbyMessage/ waitingPage.json
-
remove the next game village id in the indexeddb
A host player returns to the lobby
-
set isHost true in the indexeddb
-
save buildVillage.json in the indexeddb
-
(play the game)
-
push the "Return to the lobby"
-
remove the next village id if it is existed
-
set isPushReturnToLobbyButton true in the indexeddb
-
(client to server) villageMessage/ leaveWaitingPage.json
-
move from villageMessage to lobbyMessage
-
(client to server) lobbyMessage/ leaveWaitingPage.json
-
remove isHost from the indexeddb
-
remove buildVillage.json in the indexeddb
-
set isPushReturnToLobbyButton false in the indexeddb
A guest player returns to the lobby
-
set isHost false in the indexeddb
-
save buildVillage.json in the indexeddb
-
(play the game)
-
push the "Return to the lobby"
-
remove the next village id if it is existed
-
set isPushReturnToLobbyButton true in the indexeddb
-
move from villageMessage to lobbyMessage
-
remove isHost from the indexeddb
-
remove buildVillage.json in the indexeddb
-
set isPushReturnToLobbyButton false in the indexeddb
A guest player when the host player is returning to the lobby but they are still in the village
-
(client to server) the host player sends villageMessage/ leaveWaitingPage.json
-
(server to client) the guest players receives villageMessage/ nextGameInvitationIsClosed.json
-
undisplay the "Next game" button
-
remove nextGameVillageId from the indexeddb if it is existed.
Village message protocol contexts and IRIs
Context
Simply speaking, a context is used to map terms to IRIs. Terms are case sensitive and most valid strings that are not reserved JSON-LD keywords can be used as a term.
References
-
3.1 The Context - JSON-LD 1.1 A JSON-based Serialization for Linked Data, W3C Editor‘s Draft 22 November 2019. URL: https://w3c.github.io/json-ld-syntax/#the-context
IRI (Internationalized Resource Identifiers [RFC3987])
IRIs (Internationalized Resource Identifiers [RFC3987]) are fundamental to Linked Data as that is how most nodes and properties are identified.
IRIs in the base(.jsonld) context
-
https://werewolf.world/resource/0.3/token^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/phase^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/day^https://www.w3.org/2001/XMLSchema#unsignedShort
-
https://werewolf.world/resource/0.3/phaseTimeLimit^https://www.w3.org/2001/XMLSchema#unsignedShort
-
https://werewolf.world/resource/0.3/phaseStartTime^https://www.w3.org/2001/XMLSchema#dateTime
-
https://werewolf.world/resource/0.3/serverTimestamp^https://www.w3.org/2001/XMLSchema#dateTime
-
https://werewolf.world/resource/0.3/clientTimestamp^https://www.w3.org/2001/XMLSchema#dateTime
-
https://werewolf.world/resource/0.3/directionality^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/channel^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/extensionalDisclosureRange
IRIs in the character(.jsonld) context
-
https://werewolf.world/resource/0.3/characterIsMine^https://www.w3.org/2001/XMLSchema#boolean
-
https://werewolf.world/resource/0.3/characterName^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/characterImage^https://www.w3.org/2001/XMLSchema#anyURI
-
https://werewolf.world/resource/0.3/characterId^https://www.w3.org/2001/XMLSchema#undesignedShort
-
https://werewolf.world/resource/0.3/characterStatus^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/characterIsAChoice^https://www.w3.org/2001/XMLSchema#boolean
-
https://werewolf.world/resource/0.3/result^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/characterFullName^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/gender^https://www.w3.org/2001/XMLSchema#string
IRIs in the chat(.jsonld) context
-
https://werewolf.world/resource/0.3/chatIsMine^https://www.w3.org/2001/XMLSchema#boolean
-
https://werewolf.world/resource/0.3/chatId^https://www.w3.org/2001/XMLSchema#unsignedShort
-
https://werewolf.world/resource/0.3/chatCounter^https://www.w3.org/2001/XMLSchema#unsignedShort
-
https://werewolf.world/resource/0.3/chatInterval^https://www.w3.org/2001/XMLSchema#unsignedShort
-
https://werewolf.world/resource/0.3/chatText^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/chatIsOver^https://www.w3.org/2001/XMLSchema#boolean
-
https://werewolf.world/resource/0.3/chatIsFromServer^https://www.w3.org/2001/XMLSchema#boolean
IRIs in the error(.jsonld) context
IRIs in the role(.jsonld) context
IRIs in the scroll(.jsonld) context
-
https://werewolf.world/resource/0.3/nodeId^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/scrollTop^https://www.w3.org/2001/XMLSchema#integer
-
https://werewolf.world/resource/0.3/scrollHeight^https://www.w3.org/2001/XMLSchema#integer
-
https://werewolf.world/resource/0.3/offsetHeight^https://www.w3.org/2001/XMLSchema#integer
IRIs in the star(.jsonld) context
-
https://werewolf.world/resource/0.3/starToken^https://www.w3.org/2001/XMLSchema#string
-
https://werewolf.world/resource/0.3/starServerTimestamp^https://www.w3.org/2001/XMLSchema#dateTime
-
https://werewolf.world/resource/0.3/starClientTimestamp^https://www.w3.org/2001/XMLSchema#dateTime
-
https://werewolf.world/resource/0.3/starIsMarked^https://www.w3.org/2001/XMLSchema#boolean
IRIs in the village(.jsonld) context
IRIs in the votingResult(.jsonld) context
References
-
[RFC3987] Internationalized Resource Identifiers (IRIs). M. Duerst; M. Suignard. IETF. January 2005. Proposed Standard. URL: https://tools.ietf.org/html/rfc3987
-
3.2 IRIs - JSON-LD 1.1 A JSON-based Serialization for Linked Data, W3C Editor‘s Draft 22 November 2019. URL: https://w3c.github.io/json-ld-syntax/#iris
-
C.1 Fundamental Facets - XML Schema Part 2: Datatypes Second Edition, W3C Recommendation 28 October 2004. URL: https://www.w3.org/TR/xmlschema-2/#d0e11239