-
Notifications
You must be signed in to change notification settings - Fork 4
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 (#…
…107) * adding new topic v5 structure * cleanup * fix runtime issues * update client rest urls for new account api * fix permissions, add updated mqtt regex * update user camera permissions, subscriptions * update lasest topic schema * temp add clientid * update user presense fir last will * update topics, ttl user * update cam permissions by actual name * always request user-specific context * make realm accessible * centralize sub logs, add priv remote render sub * filter messages based on expected payload format * add server publish to private user * protect against other apps deleting objects * update logger choices to switch on message topic * fix logging issues * add/fix subsciption failure warning * move ttl to more reliable update check compoenent * fixed ttl component
- Loading branch information
Showing
8 changed files
with
348 additions
and
69 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,83 @@ | ||
namespace ArenaUnity | ||
{ | ||
|
||
public readonly struct ArenaTopics | ||
{ | ||
/** | ||
* 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) | ||
*/ | ||
public ArenaTopics( | ||
string realm = "", | ||
string name_space = "", | ||
string scenename = "", | ||
string idtag = "", | ||
string uuId = "", | ||
string userobj = "", | ||
string objectid = "", | ||
string touid = "", | ||
string devicename = "" | ||
) | ||
{ | ||
REALM = realm; | ||
nameSpace = name_space; | ||
sceneName = scenename; | ||
idTag = idtag; | ||
uuid = uuId; | ||
userObj = userobj; | ||
objectId = objectid; | ||
toUid = touid; | ||
deviceName = devicename; | ||
} | ||
public readonly string REALM { get; } | ||
public readonly string nameSpace { get; } | ||
public readonly string sceneName { get; } | ||
public readonly string idTag { get; } | ||
public readonly string uuid { get; } | ||
public readonly string userObj { get; } | ||
public readonly string objectId { get; } | ||
public readonly string toUid { get; } | ||
public readonly string deviceName { get; } | ||
|
||
#pragma warning disable format | ||
// Disable auto-format to keep alignment for readability | ||
|
||
// SUBSCRIBE | ||
public string SUB_NETWORK { get { return "$NETWORK"; } } | ||
public string SUB_DEVICE { get { return $"{REALM}/d/{deviceName}/#"; } } // All client placeholder | ||
public string SUB_PROC_REG { get { return $"{REALM}/proc/reg"; } } | ||
public string SUB_PROC_CTL { get { return $"{REALM}/proc/control/{uuid}/#"; } } | ||
public string SUB_PROC_DBG { get { return $"{REALM}/proc/debug/{uuid}"; } } | ||
public string SUB_SCENE_PUBLIC { get { return $"{REALM}/s/{nameSpace}/{sceneName}/+/+"; } } | ||
public string SUB_SCENE_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/+/+/{idTag}/#"; } } | ||
public string SUB_SCENE_RENDER_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/r/+/{idTag}/#"; } } | ||
|
||
// PUBLISH | ||
public string PUB_NETWORK_LATENCY { get { return "$NETWORK/latency"; } } | ||
public string PUB_DEVICE { get { return $"{REALM}/d/{deviceName}/{idTag}"; } } | ||
public string PUB_PROC_REG { get { return $"{REALM}/proc/reg"; } } | ||
public string PUB_PROC_CTL { get { return $"{REALM}/proc/control"; } } | ||
public string PUB_PROC_DBG { get { return $"{REALM}/proc/debug/{uuid}"; } } | ||
public string PUB_SCENE_PRESENCE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/x/{idTag}"; } } | ||
public string PUB_SCENE_PRESENCE_PRIVATE{ get { return $"{REALM}/s/{nameSpace}/{sceneName}/x/{idTag}/{toUid}"; } } | ||
public string PUB_SCENE_CHAT { get { return $"{REALM}/s/{nameSpace}/{sceneName}/c/{idTag}"; } } | ||
public string PUB_SCENE_CHAT_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/c/{idTag}/{toUid}"; } } | ||
public string PUB_SCENE_USER { get { return $"{REALM}/s/{nameSpace}/{sceneName}/u/{userObj}"; } } | ||
public string PUB_SCENE_USER_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/u/{userObj}/{toUid}"; } } // Need to add face_ privs | ||
public string PUB_SCENE_OBJECTS { get { return $"{REALM}/s/{nameSpace}/{sceneName}/o/{objectId}"; } } // All client placeholder | ||
public string PUB_SCENE_OBJECTS_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/o/{objectId}/{toUid}"; } } | ||
public string PUB_SCENE_RENDER { get { return $"{REALM}/s/{nameSpace}/{sceneName}/r/{idTag}"; } } | ||
public string PUB_SCENE_RENDER_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/r/{idTag}/-"; } } // To avoid unpriv sub | ||
public string PUB_SCENE_RENDER_PRI_SERV { get { return $"{REALM}/s/{nameSpace}/{sceneName}/r/-/{toUid}"; } } | ||
public string PUB_SCENE_ENV { get { return $"{REALM}/s/{nameSpace}/{sceneName}/e/{idTag}"; } } | ||
public string PUB_SCENE_ENV_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/e/{idTag}/-"; } } // To avoid unpriv sub | ||
public string PUB_SCENE_PROGRAM { get { return $"{REALM}/s/{nameSpace}/{sceneName}/p/{idTag}"; } } | ||
public string PUB_SCENE_PROGRAM_PRIVATE { get { return $"{REALM}/s/{nameSpace}/{sceneName}/p/{idTag}/{toUid}"; } } | ||
public string PUB_SCENE_DEBUG { get { return $"{REALM}/s/{nameSpace}/{sceneName}/d/{idTag}/-"; } } // To avoid unpriv sub | ||
#pragma warning restore format | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,35 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace ArenaUnity | ||
{ | ||
[DisallowMultipleComponent] | ||
[RequireComponent(typeof(ArenaObject))] | ||
public class ArenaTtl : MonoBehaviour | ||
{ | ||
long? expiration = null; | ||
|
||
private void Start() | ||
{ | ||
} | ||
|
||
public void SetTtlDeleteTimer(float seconds) | ||
{ | ||
expiration = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (long)(seconds * 1000); | ||
} | ||
|
||
private void Update() | ||
{ | ||
if (expiration != null && DateTimeOffset.Now.ToUnixTimeMilliseconds() > expiration) | ||
{ | ||
var aobj = GetComponent<ArenaObject>(); | ||
if (aobj != null) | ||
{ | ||
aobj.externalDelete = true; | ||
Destroy(gameObject); | ||
} | ||
} | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.