@@ -21,7 +21,7 @@ import { DEPLOY_PROFILE_SUCCESS, SEND_PROFILE_TO_RENDERER_REQUEST } from 'shared
2121import { getCurrentUserProfile } from 'shared/profiles/selectors'
2222import type { ConnectToCommsAction } from 'shared/realm/actions'
2323import { 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'
2525import { waitForRealm } from 'shared/realm/waitForRealmAdapter'
2626import type { IRealmAdapter } from 'shared/realm/types'
2727import { USER_AUTHENTICATED } from 'shared/session/actions'
@@ -591,11 +591,27 @@ function* checkDisconnectScene(
591591
592592function * 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