-
Notifications
You must be signed in to change notification settings - Fork 0
Room
黃健旻 edited this page Jan 31, 2019
·
2 revisions
class BroadcastMsg {
title: String,
content: String,
}
class ChatMsg {
from: String,
to: String,
content: String,
}
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
}
- send
socket.emit('Game', JSON.stringify({"type": "CreateRoom", "name": "Room 123", "isPublic": true}), function (acknowledgement) { ... });
- listen
socket.on('Game', function (msg: ProtocolMsg) {
...
});
- send
socket.emit('Game', JSON.stringify({"type": "ListRooms"}), function (acknowledgement) { ... });
- listen
socket.on('Game', function (msg: ProtocolMsg) {
...
});
- send
socket.emit('Game', JSON.stringify({"roomId":"RFCVG-FGBJM-VGHBJM-SRTGBI", "type": "Join"}), function (acknowledgement) { ... });
- listen
socket.on('Game', function (msg: ProtocolMsg) {
...
});
- send
socket.emit('Game', JSON.stringify({"roomId":"RFCVG-FGBJM-VGHBJM-SRTGBI", "type": "LeaveRoom"}), function (acknowledgement) { ... });
- listen
socket.on('Game', function (msg: ProtocolMsg) {
...
});
Copyright (c) 2019 CommonMarvel