Custom login sequences and message handling

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

noamgat
Posts: 10
Joined: 02 Dec 2009, 14:15

Custom login sequences and message handling

Postby noamgat » 02 Dec 2009, 14:20

Hi

(Using 1.2.4 API with 1.6.7 PRO server)

I'm using the .Net API and writing a small app to test the login options.
It seems that if using a custom login sequence (for example, connecting to zone loginZone) causes the responses to be routed to the extensionHandler event no matter what they are.

In loginExample.as, the response gets routed to the extension handler event, even though the message is one of the system events (logOK).

Is this expected behaviour? If so, is there any way to change it? It makes sense to me that having a different server-side login sequence should be transparent to the client...
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 02 Dec 2009, 14:30

Hi,
yes this is the expected behavior. Let me try to clarify.
If you specify that a Zone uses a custom login your server extension will receive all Login events and it will be responsible for handling the logic. This allows you to check the user credentials against a database, etc...

If you turn off the custom login feature the Server will use the basic internal login system which basically allows in any users, provided that they are not banned and that their name is unique.

Does this clear the mystery? :)
Last edited by Lapo on 02 Dec 2009, 16:14, edited 1 time in total.
Lapo
--
gotoAndPlay()
...addicted to flash games
noamgat
Posts: 10
Joined: 02 Dec 2009, 14:15

Postby noamgat » 02 Dec 2009, 16:05

This explain what happens, but not why.

What I mean is, this all makes sense on the server side because it allows us to be generic and write our own login sequences.
However, the client still does the same - it sends a username and a password and waits for a login result message. Or at least that is what should (in my opinion) happen.
What happens currently is that because the server has an extension, the login result will be a 'custom extension message' which means that the client has to be aware that the server is doing something special and wait for the message under a different name.
Of course its possible to cope with this, but its a bit dirty in my opinion.

In another related question - is it possible to override the generic login procedure somewhere? I want all zones to have the same (custom) login behavior. Is there any option other than specifying the extension (and db manager if I'm using a DB in it) in each and every zone thats configured through the config.xml ?

Thanks
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Dec 2009, 10:58

What happens currently is that because the server has an extension, the login result will be a 'custom extension message' which means that the client has to be aware that the server is doing something special and wait for the message under a different name.

Yes this is correct.
When using a custom login you send the response via the extension and handle it in the onExtensionResponse of your clients.

Of course its possible to cope with this, but its a bit dirty in my opinion.

I understand but consider that your application is very unlikely to move from a custom login to a default one. In general the custom login is the only way to go for any "serious" application. The default login system is more for basic applications and for simple demos.

In another related question - is it possible to override the generic login procedure somewhere?

You can handle all logins in all Zones with the same procedure by creating an extension that just listens for the login event and handles it.
Then you can attach this extension to all Zones.
This will not interfere with your main Zone Extension because it will exclusively handle the login event.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 12 guests