Skip to content

Commit

Permalink
fix: properly "categorically" ignore own msgs
Browse files Browse the repository at this point in the history
Addresses ignores of "rig" type messages where the object_id is actually
our own camera id, but comes from an external client on `/o/` topics
  • Loading branch information
hi-liang committed Nov 20, 2024
1 parent 7124933 commit cb87581
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/systems/core/mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,24 @@ AFRAME.registerSystem('arena-mqtt', {
return;
}

// Categorically ignore own messages
if (theMessage.object_id === ARENA.idTag) return;

// Dispatch on scene message type (chat, object, presence, etc.)
const sceneMsgType = topicSplit[TOPICS.TOKENS.SCENE_MSGTYPE];
const topicToUid = topicSplit[TOPICS.TOKENS.TO_UID];
const chatSystem = this.sceneEl.systems['arena-chat-ui'];
switch (sceneMsgType) {
case TOPICS.SCENE_MSGTYPES.PRESENCE:
// Categorically ignore own messages
if (theMessage.object_id === ARENA.idTag) return;
chatSystem?.onPresenceMessageArrived(theMessage, topicToUid);
break;
case TOPICS.SCENE_MSGTYPES.CHAT:
// Categorically ignore own messages
if (theMessage.object_id === ARENA.idTag) return;
chatSystem?.onChatMessageArrived(theMessage, topicToUid);
break;
case TOPICS.SCENE_MSGTYPES.USER:
// Categorically ignore own messages
if (theMessage.object_id === ARENA.idTag) return;
this.handleSceneUserMessage(theMessage, topicToUid, topicSplit);
break;
case TOPICS.SCENE_MSGTYPES.OBJECTS:
Expand Down

0 comments on commit cb87581

Please sign in to comment.