Hello,
we have an old and complicated system working on smart fox pro, and we are planning the move for smart fox 2
I'm trying to make a custom login handler, but our login function is a bit complicated
the additional data (LOGIN_OUT_DATA) you can send in the login is sufficient to send the the info we need
However, when we throw an error a login error, LOGIN_OUT_DATA is not sent to the client
we need some key value pair mechanism with the error callback
for example this is one of the errors we have:
Error: user should go to specific server, and we need to pass with it ("serverId", 1)
in sfs pro we used to send extension response for both success and failure, but there are 2 problems in sfs2
1- I want to follow the convention and use the mechanisms provided by smart fox
2- we used to send them as json, I don't want to use json only for this since SFS2 uses ISFSObject
3- we can't send extension response since in sfs2 User is null in the login handler while it wasn't in sfs pro, so I can't use send method
any suggestions to tackle this problem?
Sending key value pair in smartfox error
-
- Posts: 41
- Joined: 06 Jul 2017, 04:35
Re: Sending key value pair in smartfox error
Hi,
the error event is supposed to provide a custom error message but doesn't include custom data.
Do you need the data for some kind of logic in your client or do you just need to customize the error message so that it includes that data?
Thanks
the error event is supposed to provide a custom error message but doesn't include custom data.
Do you need the data for some kind of logic in your client or do you just need to customize the error message so that it includes that data?
Thanks
-
- Posts: 41
- Joined: 06 Jul 2017, 04:35
Re: Sending key value pair in smartfox error
Thanks for answering lapo
we need it for logic in the client side
as I mentioned in the example, if the user isn't allowed in one of our servers (we have 10 sfs servers), the server returns the error message of why the user isn't allowed, and it returns the server id the the client should be redirected to
this is an example, we have 2 or 3 errors like this
thanks again
we need it for logic in the client side
as I mentioned in the example, if the user isn't allowed in one of our servers (we have 10 sfs servers), the server returns the error message of why the user isn't allowed, and it returns the server id the the client should be redirected to
this is an example, we have 2 or 3 errors like this
thanks again
Re: Sending key value pair in smartfox error
Since you can customize the string error message, I would suggest to use that as the "transport" for the data you need on client side.
The string could contain a number of parameters separate by commas or any other token.
http://docs2x.smartfoxserver.com/Advanc ... r-messages
Hope it helps
The string could contain a number of parameters separate by commas or any other token.
http://docs2x.smartfoxserver.com/Advanc ... r-messages
Hope it helps
-
- Posts: 41
- Joined: 06 Jul 2017, 04:35
Re: Sending key value pair in smartfox error
I'm familiar with that, and I know I can send custom errors
but doesn't that mean the client needs to parse the errors from strings?
this is not a very good approach
but doesn't that mean the client needs to parse the errors from strings?
this is not a very good approach
Re: Sending key value pair in smartfox error
At least it is an effective workaround.
I have added an entry in our TODO list to support sending separate custom data in login errors.
Cheers
I have added an entry in our TODO list to support sending separate custom data in login errors.
Cheers
-
- Posts: 41
- Joined: 06 Jul 2017, 04:35
Re: Sending key value pair in smartfox error
thanks Lapo
I will send the info in extensionResponse for the mean time
thanks again
I will send the info in extensionResponse for the mean time
thanks again
-
- Posts: 41
- Joined: 06 Jul 2017, 04:35
Re: Sending key value pair in smartfox error
Hello again,
I forgot what I already mentioned
I can't send onExtensionResponse for users when the login fails because user object is still null
in sfs pro we used to send the data using the SocketChannel even when the user is null, it seems there is no similar approach in SFS2 ?
I forgot what I already mentioned
I can't send onExtensionResponse for users when the login fails because user object is still null
in sfs pro we used to send the data using the SocketChannel even when the user is null, it seems there is no similar approach in SFS2 ?
Re: Sending key value pair in smartfox error
Hi,
No that's why I suggested the workaround in my previous post.
Cheers
No that's why I suggested the workaround in my previous post.
Cheers
Who is online
Users browsing this forum: No registered users and 44 guests