Hi Lapo,
I was wondering is there documentation on where which SFSEventParam's are applicable?
I was banging my head against the desk for a long time before realizing session was a null param at the UserJoinZone stage.
I was also wondering, should the USER_LOGOUT event also fire when DISCONNECT happens?
Regards,
Josh
SFSEventParam Where Applicable
Gnoll, session is not a null param at UserJoinZone stage.
What I do, is write userData to the session in the USER_LOGIN event handler:
...then in the USER_JOIN_ZONE event handler, I do:
What I do, is write userData to the session in the USER_LOGIN event handler:
Code: Select all
ISession session = (ISession) event.getParameter(SFSEventParam.SESSION);
// Store userData in the current session.
session.setProperty("userData", userData);
Code: Select all
SFSObject userData = (SFSObject) session.getProperty("userData");
Oh yes, sorry I missed out a crucial part in USER_JOIN_ZONE handler:
Code: Select all
ISession session = user.getSession();
SFSObject userData = (SFSObject) session.getProperty("userData");
That's my point...
That works while doesn't work.
I was asking that this be documented, so we know which cases it is available in. For example it works in the LOGIN event.
That works while
Code: Select all
ISession session = (ISession) event.getParameter(SFSEventParam.SESSION);I was asking that this be documented, so we know which cases it is available in. For example it works in the LOGIN event.
@Gnoll:

http://docs2x.smartfoxserver.com/api-do ... tType.html
The SFSEventParam enum can be used all over your code. Its fields cover all the possible event parameters available in the system provided that you consult the above mentioned documentation page to check which parameters are passed in each event.
Hope it helps
You should take a closer look at the Javadoc, SFSEventType class. It documents each event clearly with all its parameters. No need to bang your head anywhereI was banging my head against the desk for a long time before realizing session was a null param at the UserJoinZone stage.
http://docs2x.smartfoxserver.com/api-do ... tType.html
The SFSEventParam enum can be used all over your code. Its fields cover all the possible event parameters available in the system provided that you consult the above mentioned documentation page to check which parameters are passed in each event.
Hope it helps