[SOLVED] Logoff vs disconnect ?

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

Logoff vs disconnect ?  

Postby toby » Mon 27 Aug 2012 12:27

In Orbiter, if I call orbiter.disconnect(), or I just close my connected-to-Union web page,
I get an exception on the SERVER side.
Here's an excerpt from the log:
Code: Select all
2012-08-27 05:43:47,194 WARN  - Exception occurred in NIOHandler for gateway [Primary Gateway] session [18].
net.user1.union.core.upc.i: XML error parsing UPC [^C�]
        at net.user1.union.core.upc.UPCParser.parse(SourceFile:37)
        at net.user1.union.core.connection.a.b.l.messageReceived(SourceFile:67)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716)
... more stack trace ... and then
2012-08-27 05:43:47,195 DEBUG - Client [13] is being removed.
2012-08-27 05:43:47,195 DEBUG - Client [13] removed from server after [1520] seconds.


If I call logoff instead, that doesn't happen:
Code: Select all
2012-08-27 05:36:11,361 DEBUG - Server sending to client [14] message [<U><M>S2C_LOGGED_OFF(u89)</M><L><A>14</A><A><![CDATA[ userid here ]]></A></L></U>]
2012-08-27 05:36:11,361 DEBUG - Client [14] is being removed.
2012-08-27 05:36:11,362 DEBUG - Client [14] removed from server after [1051] seconds.


However, if it so happens you didn't login, which you don't have to do,
since lots of activity can occur from a non-logged-in client (as in all the examples),
then it would seem to put you in a bit of a bind:
call disconnect() and get that exception, OR
don't disconnect, and you might have a heartbeat going,
because you did successfully connect, even though the login failed,
or you didn't even try one.

Also, it seems that logoff disconnects you as well, because the Heartbeat stops.
But considering that you cannot login without connecting first (right?),
that asymmetry is a little strange.

If would be logical, I would think, to be able to do:
connect()
. . . . login(user A)
. . . . logoff()
. . . . login(user B)
. . . . logoff()
disconnect()

rather than
connect - login - logoff (implied disconnect) ...
connect ... login() ... etc.

Any suggestions?
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18

Re: Logoff vs disconnect ?

Postby nyles33 » Fri 07 Sep 2012 04:41

Hi Toby,

Try sending a UPC.LEAVE_ROOM and UPC.TERMINATE_SESSION message. It seems to work for me.
nyles33
 
Posts: 13
Joined: Thu 05 Jul 2012 05:39

Re: Logoff vs disconnect ?

Postby derek » Wed 07 Nov 2012 15:44

Hi toby,

We have noticed the exception only when using websocket with firefox and when the client side initiates the disconnect (eg. closing browser). Can you confirm your environment?

The reason the exception doesn't occur when you logoff is because that is a server side disconnect.

We decided to disconnect clients on logoff to ensure the security of account data and access. To allow a logoff without disconnecting would mean that any code, including custom modules, would have to ensure that any modifications/access initiated by the login was reverted on logoff. If not done correctly then "security leaks" would occur.

For example, a module might set a client attribute when the client logs in. Now matching code has to be written to ensure the attribute is removed when the client logs off.

Or even more messy, perhaps a client was only able to join a room by virtue of being a specific logged-in account. If the client logged-off without disconnecting the server would need some way to determine that the client should be kicked out of the room.

Cheers,

Derek
derek
 
Posts: 68
Joined: Mon 17 Oct 2011 19:12

Re: Logoff vs disconnect ?

Postby toby » Wed 07 Nov 2012 21:11

We have noticed the exception only when using websocket with firefox and when the client side initiates the disconnect (eg. closing browser). Can you confirm your environment?


So confirmed.

Similarly, Firefox complains on the client side, too:
Timestamp: 11/7/2012 5:21:45 PM
Error: The connection to ws://pentolla-it.info:9100/ was interrupted while the page was loading.
Source File: http://www.pentolla.com/orbiter/orb2release.js
Line: 8

Whenever you disconnect, either explicitly or by refreshing the page.
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