Merge branch 'develop' of github.com:thecodingmachine/workadventure into GlobalMessageToWorld

This commit is contained in:
GRL 2021-07-22 17:17:25 +02:00
commit 9fa7c7aac0
3 changed files with 91 additions and 82 deletions

View File

@ -45,7 +45,8 @@ const roomManager: IRoomManagerServer = {
let room: GameRoom | null = null;
let user: User | null = null;
call.on("data", async (message: PusherToBackMessage) => {
call.on("data", (message: PusherToBackMessage) => {
(async () => {
try {
if (room === null || user === null) {
if (message.hasJoinroommessage()) {
@ -76,7 +77,11 @@ const roomManager: IRoomManagerServer = {
} else if (message.hasSilentmessage()) {
socketManager.handleSilentMessage(room, user, message.getSilentmessage() as SilentMessage);
} else if (message.hasItemeventmessage()) {
socketManager.handleItemEvent(room, user, message.getItemeventmessage() as ItemEventMessage);
socketManager.handleItemEvent(
room,
user,
message.getItemeventmessage() as ItemEventMessage
);
} else if (message.hasVariablemessage()) {
await socketManager.handleVariableEvent(
room,
@ -96,7 +101,10 @@ const roomManager: IRoomManagerServer = {
message.getWebrtcscreensharingsignaltoservermessage() as WebRtcSignalToServerMessage
);
} else if (message.hasPlayglobalmessage()) {
socketManager.emitPlayGlobalMessage(room, message.getPlayglobalmessage() as PlayGlobalMessage);
socketManager.emitPlayGlobalMessage(
room,
message.getPlayglobalmessage() as PlayGlobalMessage
);
} else if (message.hasQueryjitsijwtmessage()) {
socketManager.handleQueryJitsiJwtMessage(
user,
@ -127,6 +135,7 @@ const roomManager: IRoomManagerServer = {
emitError(call, e);
call.end();
}
})().catch((e) => console.error(e));
});
call.on("end", () => {

View File

@ -85,6 +85,6 @@ const proxyCommand = new Proxy(new WorkadventureStateCommands(), {
target.saveVariable(p.toString(), value);
return true;
},
});
}) as WorkadventureStateCommands & { [key: string]: unknown };
export default proxyCommand;

View File

@ -632,12 +632,12 @@ export class SocketManager implements ZoneEventListener {
tabUrlRooms = [clientRoomUrl];
}
let roomMessage = new AdminRoomMessage();
const roomMessage = new AdminRoomMessage();
roomMessage.setMessage(playGlobalMessageEvent.getContent());
roomMessage.setType(playGlobalMessageEvent.getType());
for (let roomUrl of tabUrlRooms) {
let apiRoom = await apiClientRepository.getClient(roomUrl);
for (const roomUrl of tabUrlRooms) {
const apiRoom = await apiClientRepository.getClient(roomUrl);
roomMessage.setRoomid(roomUrl);
apiRoom.sendAdminMessageToRoom(roomMessage, (response) => {
return;