-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Refactored topic structure for more granular flow and access (#26
) * Refactor topics using reference list * Validate topic and obj payload ids This is a core of our topic-based ACLs * hotfix runtime errors * Use defined topic positional tokens * Update to latest core topics - None of these affect persist, which only needs public objs * Update to latest core topics (again) * Add `private` `program_id` to schema * Update device pub/sub topics * update JWT checks for new topic schema * Use formatStr for MQTT topics * fix persist build error * subscribe to new objects-only topic * ttl seconds is expressed as float --------- Co-authored-by: Ivan Liang <r33t@cmu.edu>
- Loading branch information
Showing
5 changed files
with
153 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* @fileoverview Topic names for ARENA pubsub messages. | ||
* | ||
* Open source software under the terms in /LICENSE | ||
* Copyright (c) 2024 ARENAXR. All rights reserved. | ||
* @date 2024 | ||
*/ | ||
|
||
const config = require('./config.json'); | ||
|
||
/** | ||
* ARENA pubsub topic variables | ||
* - nameSpace - namespace of the scene | ||
* - sceneName - name of the scene | ||
* - userName - name of the user per arena-auth (e.g. jdoe) | ||
* - idTag - username prefixed with a uuid (e.g. 1448081341_jdoe) | ||
* - camName - idTag prefixed with camera_ (e.g. camera_1448081341_jdoe) | ||
*/ | ||
|
||
const REALM = config.mqtt.topic_realm; | ||
|
||
/* eslint-disable key-spacing */ | ||
// prettier-ignore | ||
exports.TOPICS = Object.freeze({ | ||
TOKENS: { | ||
REALM: 0, | ||
TYPE: 1, | ||
NAMESPACE: 2, | ||
SCENENAME: 3, | ||
SCENE_MSGTYPE: 4, | ||
UUID: 5, | ||
TO_UID: 6, | ||
}, | ||
SCENE_MSGTYPES: { | ||
PRESENCE: 'x', | ||
CHAT: 'c', | ||
USER: 'u', | ||
OBJECTS: 'o', | ||
RENDER: 'r', | ||
ENV: 'e', | ||
PROGRAM: 'p', | ||
DEBUG: 'd', | ||
}, | ||
SUBSCRIBE: { | ||
NETWORK: '$NETWORK', | ||
DEVICE: `${REALM}/d/{deviceName}/#`, // All client placeholder | ||
PROC_REG: `${REALM}/proc/reg`, | ||
PROC_CTL: `${REALM}/proc/control/{uuid}/#`, | ||
PROC_DBG: `${REALM}/proc/debug/{uuid}`, | ||
SCENE_PUBLIC: `${REALM}/s/{nameSpace}/{sceneName}/+/+`, | ||
SCENE_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/+/+/{idTag}/#`, | ||
}, | ||
PUBLISH: { | ||
NETWORK_LATENCY: '$NETWORK/latency', | ||
DEVICE: `${REALM}/d/{deviceName}/{idTag}`, | ||
PROC_REG: `${REALM}/proc/reg`, | ||
PROC_CTL: `${REALM}/proc/control`, | ||
PROC_DBG: `${REALM}/proc/debug/{uuid}`, | ||
SCENE_PRESENCE: `${REALM}/s/{nameSpace}/{sceneName}/x/{idTag}`, | ||
SCENE_PRESENCE_PRIVATE:`${REALM}/s/{nameSpace}/{sceneName}/x/{idTag}/{toUid}`, | ||
SCENE_CHAT: `${REALM}/s/{nameSpace}/{sceneName}/c/{idTag}`, | ||
SCENE_CHAT_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/c/{idTag}/{toUid}`, | ||
SCENE_USER: `${REALM}/s/{nameSpace}/{sceneName}/u/{userObj}`, | ||
SCENE_USER_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/u/{userObj}/{toUid}`, // Need to add face_ privs | ||
SCENE_OBJECTS: `${REALM}/s/{nameSpace}/{sceneName}/o/{objectId}`, // All client placeholder | ||
SCENE_OBJECTS_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/o/{objectId}/{toUid}`, | ||
SCENE_RENDER: `${REALM}/s/{nameSpace}/{sceneName}/r/{idTag}`, | ||
SCENE_RENDER_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/r/{idTag}/-`, // To avoid unpriv sub | ||
SCENE_ENV: `${REALM}/s/{nameSpace}/{sceneName}/e/{idTag}`, | ||
SCENE_ENV_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/e/{idTag}/-`, // To avoid unpriv sub | ||
SCENE_PROGRAM: `${REALM}/s/{nameSpace}/{sceneName}/p/{idTag}`, | ||
SCENE_PROGRAM_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/p/{idTag}/{toUid}`, | ||
SCENE_DEBUG: `${REALM}/s/{nameSpace}/{sceneName}/d/{idTag}/-`, // To avoid unpriv sub | ||
}, | ||
}); | ||
|
||
// export default TOPICS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters