Hoping for some help: attribute from wrong client?

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

Hoping for some help: attribute from wrong client?

Postby toby » Sun 07 Dec 2014 16:01

I recently upgraded to Union 2.1.1 from Union 2.0.0.

Today I saw the following happen:

client A is logged in.
client B logs in and joins a room.

When B joins the room A is notified via an ADD_OCCUPANT event.

I then do this:
Code: Select all
function addOccupantListener(e) // e is a RoomEvent
{
addToRoom(e);
... other code
}

function addToRoom(e)
{
var r = e.target.getSimpleRoomID();
var rr = e.target.getRoomID();
var id = e.getClientID();
var c = e.getClient();
var name = getPlayerName(c);
... other code
}

function getPlayerName(cl)
{
var name=cl.getAttribute("playername");
return name;
}


The problem is:
what is returned in (seemingly rare) cases is: instead of client B's player name, it's client A's own name
(or perhaps some other one -- I only observed this when I myself was client A).

From the server logs, I see that client B's name is set correctly,
and the client attributes included with the u36 message are all in good order.
And in fact all the other client attributes were handled correctly without this mixup.

From that point on, wherever clent B's name should have appeared, it had client A's name.
Logging out and logging back in did not change the situation,
but logging out, refreshing the page, logging back in did.

I don't see where my code can go wrong here ... it surely works 'almost' all the time -
and I'm hoping someone can give me some clues ...
Since this only happens rarely, and appears to be a
client-side bug (either in Union or in my code) it will be very hard to gather
evidence. HELLLLLLLLLLPPPP !

This seems similar to a reproducible problem I posted on another thread:
viewtopic.php?f=3&t=365
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18

Re: Hoping for some help: attribute from wrong client?

Postby toby » Fri 12 Dec 2014 04:08

My "solution" ?
Well, it's a workaround really, and a rather crude one at that.

When a client logs off, I call location.reload( ) to clear everything out.

I have not seen the problem recur, but it was a rarity to begin with.
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18


Return to Union Platform

Online

Users browsing this forum: No registered users and 2 guests