From 58f4eba535de1894589cb9dfa455da3e3376fb8d Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Wed, 31 Oct 2018 04:46:30 +0000 Subject: [PATCH] Join ret channel first --- src/hub.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hub.js b/src/hub.js index 84a0e496f..93221603b 100644 --- a/src/hub.js +++ b/src/hub.js @@ -380,6 +380,16 @@ document.addEventListener("DOMContentLoaded", async () => { hmd: availableVREntryTypes.isInHMD }; + // Reticulum global channel + const retPhxChannel = socket.channel(`ret`, { hub_id: hubId }); + retPhxChannel + .join() + .receive("ok", async data => subscriptions.setVapidPublicKey(data.vapid_public_key)) + .receive("error", res => { + subscriptions.setVapidPublicKey(null); + console.error(res); + }); + const pushSubscriptionEndpoint = await subscriptions.getCurrentEndpoint(); const joinPayload = { profile: store.state.profile, push_subscription_endpoint: pushSubscriptionEndpoint, context }; const hubPhxChannel = socket.channel(`hub:${hubId}`, joinPayload); @@ -495,15 +505,5 @@ document.addEventListener("DOMContentLoaded", async () => { addToPresenceLog({ name: userInfo.metas[0].profile.displayName, type, body }); }); - // Reticulum global channel - const retPhxChannel = socket.channel(`ret`, { hub_id: hubId }); - retPhxChannel - .join() - .receive("ok", async data => subscriptions.setVapidPublicKey(data.vapid_public_key)) - .receive("error", res => { - subscriptions.setVapidPublicKey(null); - console.error(res); - }); - linkChannel.setSocket(socket); }); -- GitLab