-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtopics.js
79 lines (74 loc) · 3.62 KB
/
topics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* @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
* - userClient - name of the user client per arena-auth (e.g. jdoe_1448081341_web)
* - idTag - username prefixed with a uuid (e.g. jdoe_1448081341)
* - userObj - idTag prefixed with camera_ (e.g. camera_jdoe_1448081341)
*/
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,
USER_CLIENT: 5,
UUID: 6,
TO_UID: 7,
},
SCENE_MSGTYPES: {
PRESENCE: 'x',
CHAT: 'c',
USER: 'u',
OBJECTS: 'o',
RENDER: 'r',
ENV: 'e',
PROGRAM: 'p',
DEBUG: 'd',
},
SUBSCRIBE: {
NETWORK: '$NETWORK',
DEVICE: `${REALM}/d/{nameSpace}/{deviceName}/#`, // All client placeholder
RT_RUNTIME: `${REALM}/g/{nameSpace}/p/{rtUuid}`,
RT_MODULES: `${REALM}/s/{nameSpace}/{sceneName}/p/+/+`,
SCENE_PUBLIC: `${REALM}/s/{nameSpace}/{sceneName}/+/+/+`,
SCENE_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/+/+/+/{idTag}/#`,
SCENE_RENDER_PUBLIC: `${REALM}/s/{nameSpace}/{sceneName}/r/+/-`, // TODO: consolidate
SCENE_RENDER_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/r/+/-/{idTag}/#`, // TODO: consolidate
},
PUBLISH: {
NETWORK_LATENCY: '$NETWORK/latency',
DEVICE: `${REALM}/d/{nameSpace}/{deviceName}/{idTag}`,
RT_RUNTIME: `${REALM}/g/{nameSpace}/p/{rtUuid}`,
RT_MODULES: `${REALM}/s/{nameSpace}/{sceneName}/p/{userClient}/{idTag}`,
PROC_DBG: `${REALM}/proc/debug/{uuid}`,
SCENE_PRESENCE: `${REALM}/s/{nameSpace}/{sceneName}/x/{userClient}/{idTag}`,
SCENE_PRESENCE_PRIVATE:`${REALM}/s/{nameSpace}/{sceneName}/x/{userClient}/{idTag}/{toUid}`,
SCENE_CHAT: `${REALM}/s/{nameSpace}/{sceneName}/c/{userClient}/{idTag}`,
SCENE_CHAT_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/c/{userClient}/{idTag}/{toUid}`,
SCENE_USER: `${REALM}/s/{nameSpace}/{sceneName}/u/{userClient}/{userObj}`,
SCENE_USER_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/u/{userClient}/{userObj}/{toUid}`, // Need to add face_ privs
SCENE_OBJECTS: `${REALM}/s/{nameSpace}/{sceneName}/o/{userClient}/{objectId}`, // All client placeholder
SCENE_OBJECTS_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/o/{userClient}/{objectId}/{toUid}`,
SCENE_RENDER: `${REALM}/s/{nameSpace}/{sceneName}/r/{userClient}/{idTag}`,
SCENE_RENDER_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/r/{userClient}/{idTag}/-`, // To avoid unpriv sub
SCENE_ENV: `${REALM}/s/{nameSpace}/{sceneName}/e/{userClient}/{idTag}`,
SCENE_ENV_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/e/{userClient}/{idTag}/-`, // To avoid unpriv sub
SCENE_PROGRAM: `${REALM}/s/{nameSpace}/{sceneName}/p/{userClient}/{idTag}`,
SCENE_PROGRAM_PRIVATE: `${REALM}/s/{nameSpace}/{sceneName}/p/{userClient}/{idTag}/{toUid}`,
SCENE_DEBUG: `${REALM}/s/{nameSpace}/{sceneName}/d/{userClient}/{idTag}/-`, // To avoid unpriv sub
},
});
// export default TOPICS;