GetSecretKey() returns null

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

GetSecretKey() returns null

Postby potmo » 24 Sep 2008, 08:58

Hi!

Im using SmartFox 1.6.1 on mac and I' get a quite strange error with getSecretKey()

i write
it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.instance().getSecretKey(channel)
where channel is a SocketChannel and the open-property of that channel is set to true (i guess that means that the socket is open).

the strange thing is that getSecretKey returns null always. I haven't seen I had a problem since I add that key to a static "password" and checksum that with a MD5 for a handshake. But now when looking at it the handshake checksum is always the same and not session-unique (since getSecretKey returns null).

The strange thing is that I don't get any compile error or anything. The documentation states that getSecretKey should be implemented since v1.3.0 so it cant be that I use an too old version.

Anyone got a clue on this? It happens on another system with v1.6.2 running on Linux as well.
Nisse Bergman
Raketspel
User avatar
Lapo
Site Admin
Posts: 21685
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 25 Sep 2008, 19:52

The secret key is lazily generated. In other words that field is populated only after the client has requested the secret key.
If you get a null the client has not yet asked for that key.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Postby potmo » 25 Sep 2008, 21:26

okay. is there anyway to get a secretkey without having the client request it? Maybe just create a MD5 of some id that is unique to the connection?
Nisse Bergman

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

Postby Lapo » 26 Sep 2008, 07:57

No, the client must ask for a unique key, first.
Until the client has not received it, you can't do anything on the server side.
So, first make sure that the client requests the key.
Once this is done, the key is available also on the server side and you can perform the server side logic.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 19 guests