Skip to content
黃健旻 edited this page Jan 31, 2019 · 2 revisions
class RoomIdName {
     id: String,
     name: String,
}
class MemberInfo {
     account: String,
     character: String,
     status: String,
}
class Protocol {
     roomId: String,
     name: String,
     type: String,
     rooms: List<RoomIdName>,
     membersInfo: List<MemberInfo>,
     killWho: String,
     beatWho: String,
     from: String,
     msg: String,
     isPublic: Boolean
}

RequestStartGame

  • send
socket.emit('Game', JSON.stringify({"type": "CreateRoom", "name": "Room 123", "isPublic": true}), function (acknowledgement) { ... });
  • listen
socket.on('Game', function (msg: ProtocolMsg) {
    ...
});

RequestSwitchDay

  • send
socket.emit('Game', JSON.stringify({"roomId":"RFCVG-FGBJM-VGHBJM-SRTGBI", "type": "RequestSwitchDay"}), function (acknowledgement) { ... });
  • listen
socket.on('Game', function (msg: ProtocolMsg) {
    ...
});

RequestSwitchNight

  • send
socket.emit('Game', JSON.stringify({"roomId":"RFCVG-FGBJM-VGHBJM-SRTGBI", "type": "RequestSwitchNight"}), function (acknowledgement) { ... });
  • listen
socket.on('Game', function (msg: ProtocolMsg) {
    ...
});

RequestKill

  • send
socket.emit('Game', JSON.stringify({"roomId":"RFCVG-FGBJM-VGHBJM-SRTGBI", "type": "RequestKill", "killWho": "Vincent"}), function (acknowledgement) { ... });
  • listen
socket.on('Game', function (msg: ProtocolMsg) {
    ...
});

RequestBeat

  • send
socket.emit('Game', JSON.stringify({"roomId":"RFCVG-FGBJM-VGHBJM-SRTGBI", "type": "RequestBeat", "beatWho": "Vincent"}), function (acknowledgement) { ... });
  • listen
socket.on('Game', function (msg: ProtocolMsg) {
    ...
});