Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  ClientSessions  (Read 1147 times)
0 Members and 1 Guest are viewing this topic.
Offline floersh

Senior Newbie





« Posted 2007-03-21 15:29:56 »

I was wondering if anyone knows if the ClientSession's identity (aka the value returned from getName()) MUST be unique? I notice that each ClientSession object has a ClientSessionId which appears to be unique. But does the identity also have ot be unique with a game? (Aka does the ClientSession get persisted using the sessionid or the identity?

Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2007-03-21 15:46:50 »

I was wondering if anyone knows if the ClientSession's identity (aka the value returned from getName()) MUST be unique?

The name is provided  by the authenticator, (The entire internal Identity object actually is. That will make more sense when you have the document on writing Authenticators that I'm writing now.)  So the answer to your question is that it is completely up to the policy of the authenticator.

Quote
I notice that each ClientSession object has a ClientSessionId which appears to be unique. But does the identity also have ot be unique with a game? (Aka does the ClientSession get persisted using the sessionid or the identity?

A ClientSession and everything relating to it is only valid for the life of the session.  So while it is unique at a  point in time, its not necessarily historically unique.

If you want a unique identifier other then name, it should be provided by your authenticator in an extended Identity object that you use a custom manager/service pair to read.  Again, this is all in the doc I'm writing now.

Does that make sense?


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline floersh

Senior Newbie





« Reply #2 - Posted 2007-03-21 16:24:14 »

Does that make sense?

Yes but maybe I ought to change the way I ask the question. What would I lose if the name was not unique? I was thiking about doing the authentication at the application level rather than extending the stack by building my own Authenticator like discussed in anoher thread. However, I would still use the SimpleClient's basic authentication I would simply always return the client type for the userid and a null password. Obviously if I used a null password I would use the NullAuthenticator.

But by doing that I could have dozens of ClientSessions all with a getName() of say "Full" or "Demo" as an example.

I guess it would make it impossible to bind the old ClientSessionListener with the new ClientSession as I would have no way to locate the ClientSessionListener until after the binding had already occured in the AppListeners.loggedIn() method. Is there any other issues I might encounter?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2007-03-21 16:32:58 »


I guess it would make it impossible to bind the old ClientSessionListener with the new ClientSession as I would have no way to locate the ClientSessionListener until after the binding had already occured in the AppListeners.loggedIn() method. Is there any other issues I might encounter?



Thats basically it.

Note though that if you didn't want to store info about a DEMO user this would be no problem.
You would simply special case a user name of "demo" or "guest" and create a new, unbound ClientSessionListener ManagedObject for everyone who joined that way and remove them from the ObjectStore on disconnect.

About the only other issue I can think of is that, currently, if your reject a user by returning null from loggedIn rather then by rejecting in the authenticator you cannot pass a "reason" string back to the client.

Oh and DONT use disconnect() in loggedIn().  Thats wrong and will make odd thinsg happen in the current release.  To reject the user just return a null ClientSessionListener

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline floersh

Senior Newbie





« Reply #4 - Posted 2007-03-21 17:01:36 »

Thats basically it.

Note though that if you didn't want to store info about a DEMO user this would be no problem.
You would simply special case a user name of "demo" or "guest" and create a new, unbound ClientSessionListener ManagedObject for everyone who joined that way and remove them from the ObjectStore on disconnect.

About the only other issue I can think of is that, currently, if your reject a user by returning null from loggedIn rather then by rejecting in the authenticator you cannot pass a "reason" string back to the client.

Oh and DONT use disconnect() in loggedIn().  Thats wrong and will make odd thinsg happen in the current release.  To reject the user just return a null ClientSessionListener

Ahhh some very good points.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (34 views)
2013-05-17 21:29:12

alaslipknot (42 views)
2013-05-16 21:24:48

gouessej (72 views)
2013-05-16 00:53:38

gouessej (71 views)
2013-05-16 00:17:58

theagentd (79 views)
2013-05-15 15:01:13

theagentd (74 views)
2013-05-15 15:00:54

StreetDoggy (116 views)
2013-05-14 15:56:26

kutucuk (139 views)
2013-05-12 17:10:36

kutucuk (140 views)
2013-05-12 15:36:09

UnluckyDevil (147 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.089 seconds with 20 queries.