Skip to content

Commit 0f93827

Browse files
Hugo Arreguigonpombo8
authored andcommitted
use gatekeeper to fetch scene room
1 parent b0cc8b3 commit 0f93827

File tree

1 file changed

+21
-5
lines changed
  • browser-interface/packages/shared/comms

1 file changed

+21
-5
lines changed

browser-interface/packages/shared/comms/sagas.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { DEPLOY_PROFILE_SUCCESS, SEND_PROFILE_TO_RENDERER_REQUEST } from 'shared
2121
import { getCurrentUserProfile } from 'shared/profiles/selectors'
2222
import type { ConnectToCommsAction } from 'shared/realm/actions'
2323
import { CONNECT_TO_COMMS, setRealmAdapter, SET_REALM_ADAPTER } from 'shared/realm/actions'
24-
import { getFetchContentUrlPrefixFromRealmAdapter } from 'shared/realm/selectors'
24+
import { getFetchContentUrlPrefixFromRealmAdapter, getRealmAdapter } from 'shared/realm/selectors'
2525
import { waitForRealm } from 'shared/realm/waitForRealmAdapter'
2626
import type { IRealmAdapter } from 'shared/realm/types'
2727
import { USER_AUTHENTICATED } from 'shared/session/actions'
@@ -591,11 +591,27 @@ function* checkDisconnectScene(
591591

592592
function* connectSceneToComms(sceneId: string) {
593593
console.log('[SceneComms]: connectSceneToComms', sceneId)
594-
// Fetch connection string
595-
// const connectionString = `https://boedo.com/${sceneId}`
596-
const connectionString = `offline:offline`
594+
595+
const realmAdapter = yield select(getRealmAdapter)
596+
if (!realmAdapter) {
597+
throw new Error('No realm adapter') // TODO
598+
}
599+
const realmName = realmAdapter.about.configurations?.realmName
600+
597601
const identity: ExplorerIdentity = yield select(getCurrentIdentity)
598-
const sceneRoomConnetion = yield call(connectAdapter, connectionString, identity, sceneId)
602+
// TODO: we should change the adapter control to provide this url
603+
const url = 'https://comms-gatekeeper.decentraland.zone/get-scene-adapter'
604+
const response = yield call(signedFetch,
605+
url,
606+
identity,
607+
{ method: 'POST', responseBodyType: 'json' },
608+
{
609+
realmName,
610+
sceneId
611+
}
612+
)
613+
614+
const sceneRoomConnetion = yield call(connectAdapter, response.json.adapter, identity, sceneId)
599615
yield call(bindHandlersToCommsContext, sceneRoomConnetion, false)
600616
yield put(setSceneRoomConnection(sceneId, sceneRoomConnetion))
601617
}

0 commit comments

Comments
 (0)