Skip to content

Commit

Permalink
missing sub u and proc scene only
Browse files Browse the repository at this point in the history
  • Loading branch information
mwfarb committed Aug 14, 2024
1 parent 79a3928 commit 53a9a8e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions users/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,30 @@ def generate_arena_token(
namespace = parts[0]
deviceid = parts[1]

# api-versioned topics
# -- VERSIONED API TOPICS --
if version == API_V2:
pubs, subs = pubsub_api_v2(
user, username, realm, namespace, sceneid, deviceid, ids, perm)
else:
pubs, subs = pubsub_api_v1(
user, username, realm, namespace, sceneid, deviceid, ids, perm)

# network graph
# -- NON-VERSIONED API TOPICS --

# runtime manager
# only rendered scenes need the runtime manager
if sceneid:
subs.append(f"{realm}/proc/#")
pubs.append(f"{realm}/proc/#")

# network metrics
# only non-specific scene/device should monitor latency data
if not sceneid:
subs.append("$NETWORK")
# every client can/should publish latency data
pubs.append("$NETWORK/latency")

# consolidate topics and issue token
if len(subs) > 0:
payload["subs"] = clean_topics(subs)
if len(pubs) > 0:
Expand Down Expand Up @@ -241,9 +250,6 @@ def pubsub_api_v1(
if sceneid:
subs.append(f"{realm}/g/a/#")
pubs.append(f"{realm}/g/a/#")
# arts runtime-mngr
subs.append(f"{realm}/proc/#")
pubs.append(f"{realm}/proc/#")

return pubs, subs

Expand Down Expand Up @@ -314,6 +320,7 @@ def pubsub_api_v2(
pubs.append(f"{realm}/s/{namespace}/{sceneid}/o/+")
# user presence objects
if ids and perm["users"]: # probable web browser write
subs.append(f"{realm}/s/{namespace}/{sceneid}/u/+")
for userobj in ids:
pubs.append(
f"{realm}/s/{namespace}/{sceneid}/u/{ids[userobj]}")
Expand All @@ -323,9 +330,6 @@ def pubsub_api_v2(
pubs.append(f"{realm}/s/{namespace}/{sceneid}/x/{ids['userid']}/#")
subs.append(f"{realm}/s/{namespace}/{sceneid}/c/+")
pubs.append(f"{realm}/s/{namespace}/{sceneid}/c/{ids['userid']}/#")
# runtime manager
subs.append(f"{realm}/proc/#")
pubs.append(f"{realm}/proc/#")

return pubs, subs

Expand Down

0 comments on commit 53a9a8e

Please sign in to comment.