Problems with not-logged-in clients

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

Problems with not-logged-in clients

Postby toby » Mon 17 Nov 2014 03:53

At present, I am still on Union 2.0.0 (it's been working great, so why "fix" problems
I don't have. Although I am planning to upgrade soon.)

Up to now, I have required users to create an account and login using it.
Now I'd like to offer functionality to clients that don't log in, just connect.

Terminology: LIC = logged in client, Guest = connected, not-logged-in client.

It seems to go pretty well ... except for one thing.

Exiting, then re-entering doesn't work ... the failures are kind of weird,
and a little difficult to describe, but I think the place to start is here:

To exit the app (and return to the front-door page),
an LIC uses orbiter.getAccountManager.().logoff()

That seems to work great.
LIC's disappear from UnionAdmin list of clients right away.
If they then re-log-in immediately, everything is cool.
In other words, the clean-up after the departure is fast and effective.
(A comment in my code says the logoff "disconnects, too", so I don't
call disconnect, nor do I wait for or process a result event.)

With Guests ... not so much.

>>> So here's the question: How should I code a Guest exiting?

Here's what I tried:
  • orbiter.disconnect() ... then it takes a few seconds to disappear from UnionAdmin,
    and the same window client can login as a new client in the interim. So both can appear
    in UnionAdmin for a while, and afterwards, things like sending a message to a room
    aren't delivered to the new client. -- FAILED
    ( Do I need to wait for a result event on that before connecting again?
    Or wait for that until trying another connection? And if so how to I make it
    as fast as the logoff() call seems to be? )
  • accountManager.logoff() --- that seems inappropriate, and also seems to cause other problems. -- FAILED
  • orbiter.dispose() -- causes errors inside orbiter, such as "X is not a function" (where I don't remember
    what X is). -- FAILED
  • location.reload --- reinitialize the page. That seems to work, but since the page is kind of
    hefty, would increase traffic to the website and looks bad as the screen goes blank for a second. -- WORKS, BUT UGLY


ADDITIONAL INFO added to original post:
1) I measured how long it takes for the client to disappear from UnionAdmin: it's around 20 seconds.
That's enough time for me to click my ENTER and EXIT buttons several times, on one try I had
six of them in there at once, and then watched as they disappeared one by one.

2) Using disconnect() I never get an orbiter CLOSE event ... with the logoff() call,
it shows up right away.

Please help me on this ... it really is blocking my deploying this important new feature.
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18

Re: Problems with not-logged-in clients

Postby toby » Tue 18 Nov 2014 03:27

I think I found a less-unsatisfactory-than-the-others solution.

That is:
when I re-enter my app, I unconditionally open a new connection (orbiter.connect())
whether I think I might already have one or not.

Then I see these messages in the client browser log:
"11/17/14 23:13:17.418 UTC-8 INFO: [CONNECTION_MANAGER] Removing all connections..." orbiter.js:8
"11/17/14 23:13:17.422 UTC-8 INFO: [CONNECTION_MANAGER] All connections removed." orbiter.js:8
"11/17/14 23:13:17.424 UTC-8 INFO: [CONNECTION_MANAGER] New connection added.

And that seems to clean things up sufficiently to avoid "client confusion".

It may still take some seconds for the earlier client to disappear from UnionAdmin,
but that shouldn't be a problem: most of the time the return of the user will be
after more time than it takes has elapsed, and even if not, there don't appear
to be any problems.
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18

Re: Problems with not-logged-in clients

Postby toby » Mon 01 Dec 2014 02:07

I un-did that change ... blasting open a new connection wasn't always the right thing to do.

My latest attempt, which seems like it might be the best way to go,
is prior to calling orbiter.disconnect()
I send a signoff message to the server which calls client.shutdown()
and presto! that client disappears from the server.

Seems to me that the disconnect() call should do that on its own,
but since it doesn't, this seems like a good workaround.
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18


Return to Union Platform

Online

Users browsing this forum: No registered users and 5 guests