Skip to content

Commit

Permalink
Revert "scene room may be connected before island room"
Browse files Browse the repository at this point in the history
This reverts commit f936182.
  • Loading branch information
Hugo Arregui committed Dec 28, 2023
1 parent 83bea80 commit ecec335
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions browser-interface/packages/shared/comms/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,36 @@ export const getCommsRoom = (state: RootCommsState): RoomConnection | undefined
const islandRoom = state.comms.context
const sceneRoom = state.comms.scene

// if (!islandRoom) return undefined
if (!islandRoom) return undefined

return {
connect: async () => {
debugger
},
// events: islandRoom.events,
disconnect: async () => {
if (islandRoom) {
await islandRoom.disconnect()
}
await islandRoom.disconnect()
// TBD: should we disconnect from scenes here too ?
},
// TBD: This should be only be sent by the island ?
// We may remove this before reach production, but to think about it
sendProfileMessage: async (profile: AnnounceProfileVersion) => {
const island = islandRoom?.sendProfileMessage(profile)
const island = islandRoom.sendProfileMessage(profile)
const scene = sceneRoom?.sendProfileMessage(profile)
await Promise.all([island, scene])
},
sendProfileRequest: async (request: ProfileRequest) => {
const island = islandRoom?.sendProfileRequest(request)
const island = islandRoom.sendProfileRequest(request)
const scene = sceneRoom?.sendProfileRequest(request)
await Promise.all([island, scene])
},
sendProfileResponse: async (response: ProfileResponse) => {
const island = islandRoom?.sendProfileResponse(response)
const island = islandRoom.sendProfileResponse(response)
const scene = sceneRoom?.sendProfileResponse(response)
await Promise.all([island, scene])
},
sendPositionMessage: async (position: Omit<Position, 'index'>) => {
const island = islandRoom?.sendPositionMessage(position)
const island = islandRoom.sendPositionMessage(position)
const scene = sceneRoom?.sendPositionMessage(position)
await Promise.all([island, scene])
},
Expand All @@ -70,7 +68,7 @@ export const getCommsRoom = (state: RootCommsState): RoomConnection | undefined
await sceneRoom?.sendParcelSceneMessage(message)
},
sendChatMessage: async (message: Chat) => {
const island = islandRoom?.sendChatMessage(message)
const island = islandRoom.sendChatMessage(message)
const scene = sceneRoom?.sendChatMessage(message)
await Promise.all([island, scene])
},
Expand All @@ -82,6 +80,7 @@ export const getCommsRoom = (state: RootCommsState): RoomConnection | undefined
createVoiceHandler: async () => {
// TBD: Feature flag for backwards compatibility
if (!sceneRoom) {
debugger
throw new Error('Scene room not avaialble')
}
return sceneRoom.createVoiceHandler()
Expand Down

0 comments on commit ecec335

Please sign in to comment.