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

View File

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

View File

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