[SOLVED] Each room needs its own message stream?

All Union Platform questions, comments, feature requests, and bug reports.

Each room needs its own message stream?

Postby toby » Mon 24 Sep 2012 13:24

I was looking into an unrelated problem, and opened my client side console in
Chrome, where I saw these messages:

Code: Select all
9/24/12 10:14:25.272 UTC-7 DEBUG: Message listener ignored message: gamedata.
Listener registered to receive messages sent to: Practice.001,
but message was sent to: Practice.002 orb2release.js:8

9/24/12 10:14:25.272 UTC-7 WARN:  No message listener handled incoming message:
gamedata, sent to: Practice.002 orb2release.js:8


I will have several rooms going, all doing the same type of thing, but with different data.
Think multiple chat rooms, each with its own stream of chat.

So they all use the same "message name", in my case it's "gamedata" instead of "CHAT_MESSAGE".
So that they will know about other clients coming and going around them,
clients observe, but don't join, the other rooms.
But they don't want this type of message for other rooms.

Do observers get all the message traffic too?
There seems to be little distinction between observing and joining a room.

What is the reason for these warnings?
The behavior seems to be what is desired.
If you're not listening for messages, isn't that your choice?

Instead of the generic message name "gamedata",
should I create a different one for each room?
(gamedata.001, gamedata.002, ... etc?)
That seems silly, since the messages are already room-specific.
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18

Re: Each room needs its own message stream?  

Postby colin » Fri 16 Nov 2012 03:23

hi toby,
you're encountering some variation of the following scenario:

-clientX joins roomA and roomB
-clientX calls roomA.addMessageListener("message1", message1Listener)
-clientY sends "message1" to roomB
-clientX receives "message1", but "message1" was sent to roomA so message1Listener is not executed

in the preceding scenario, Orbiter logs the debug notification that you saw in the console: "Message listener ignored message"

the notification is not an error report, nor a warning (note the level, "DEBUG"). it's simply a debugging message made available for the programmer to confirm that everything is working as intended (the message is successfully being ignored).

in some applications, a message listener might handle messages for a group of rooms. for example, a multi-room chat application might displays a notification icon when a new message is received in any room. for a longer discussion on message listening across multiple rooms, see Reactor's docs for MessageManager's addMessageListener() method (note that Reactor's API is nearly identical to Orbiter's):

http://unionplatform.com/docs/reactor/a ... nager.html *

by default, as you've noticed, observers receive room messages. but that is optional. to opt out of room messages, a client (observer or occupant) can set its UpdateLevels for the room.

example JavaScript code:

Code: Select all
   var updateLevels = new net.user1.orbiter.UpdateLevels();
   updateLevels.roomMessages = false;
   theRoom.join(null, updateLevels);


ActionScript equivalent:

Code: Select all
   var updateLevels:UpdateLevels = new UpdateLevels();
   updateLevels.roomMessages = false;
   theRoom.join(null, updateLevels);


regarding observers vs occupants, observers are not included in the room's occupant count, and can be treated as a group for processing or data synchronization. for example, observers can be configured (via UpdateLevels) to receive all information sent to a room, but be completely ignored by (invisible to) room occupants. here are the UpdateLevels a room occupant would use to ignore observers:

var levels = new net.user1.orbiter.UpdateLevels();
levels.observerCount = false;
levels.observerList = false;
levels.observerLoginLogoff = false;
levels.sharedObserverAttributesGlobal = false;
levels.sharedObserverAttributesRoom = false;

for more info, see:
http://unionplatform.com/docs/reactor/a ... evels.html *

colin

* for the latest version of the API docs, see: http://unionplatform.com/docs/reactor/api/
colin
 
Posts: 232
Joined: Mon 17 Oct 2011 18:47

Re: Each room needs its own message stream?

Postby toby » Fri 16 Nov 2012 03:49

Thanks again ...

I had already come up with that solution,
and it's nice to have "official confirmation".

I also turned off update levels for
Occupant_Login_Logoff and Occupant_Count.
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18


Return to Union Platform

Online

Users browsing this forum: No registered users and 1 guest