Hi there, I'd like to know how you'd disallow users from connecting if they're on an older version of the client.
Let's say there is a string variable called "version" = 1.0, but a new update is out for version 1.1.
How would I make it so users who connect to my smartfoxserver be kicked for needing to update?
Thanks!
Disallow older clients from connecting to the server.
-
- Posts: 4
- Joined: 12 Jun 2021, 17:42
Re: Disallow older clients from connecting to the server.
Hi,
you can send custom data with the Login request object so you could send the client version and verify it on the server side, only allowing in players with the correct version.
Here's an example of server side login:
https://smartfoxserver.com/blog/how-to- ... tom-login/
The client side LoginRequest constructor looks like this (Java):
Where the last params is the custom data object you can use.
It works the same in all other client side API as well.
Cheers
you can send custom data with the Login request object so you could send the client version and verify it on the server side, only allowing in players with the correct version.
Here's an example of server side login:
https://smartfoxserver.com/blog/how-to- ... tom-login/
The client side LoginRequest constructor looks like this (Java):
Code: Select all
public LoginRequest(String userName, String password, String zoneName, ISFSObject params)
Where the last params is the custom data object you can use.
It works the same in all other client side API as well.
Cheers
-
- Posts: 4
- Joined: 12 Jun 2021, 17:42
Re: Disallow older clients from connecting to the server.
Is it possible to do this with SFSEvent.onLogin or SFSEvent.onConnection?
Re: Disallow older clients from connecting to the server.
Sorry,
I just noticed you posted under the SFS PRO 1.x section... so you're not referring to SFS2X, right?
I just noticed you posted under the SFS PRO 1.x section... so you're not referring to SFS2X, right?
-
- Posts: 4
- Joined: 12 Jun 2021, 17:42
Re: Disallow older clients from connecting to the server.
Correct. I am using SmartFoxServer Pro 1.x!
Re: Disallow older clients from connecting to the server.
Ok sorry, my bad
In any case the process should be the same, with a slight variation.
In SFS1.x you will need to login first, then from client side send an Extension call with the client version. Server side you can validate it and disconnect the user if you decide it's not valid.
Cheers
In any case the process should be the same, with a slight variation.
In SFS1.x you will need to login first, then from client side send an Extension call with the client version. Server side you can validate it and disconnect the user if you decide it's not valid.
Cheers
-
- Posts: 4
- Joined: 12 Jun 2021, 17:42
Re: Disallow older clients from connecting to the server.
Okay, I threw something together that almost works perfectly. But, since clients are using an older version that doesn't send any version info to the server. How would I via the server-side extension. (I am using an actionscript extension) tell it that if there is no information from the client, then disconnect the user?
It currently will remove the user if the version is not the same but if it doesn't send any message to the server at all they can still connect fine since the server never received the message. Any examples? I couldn't find anything like this. But maybe I did something a little unintuitive. Let me know!
It currently will remove the user if the version is not the same but if it doesn't send any message to the server at all they can still connect fine since the server never received the message. Any examples? I couldn't find anything like this. But maybe I did something a little unintuitive. Let me know!
Re: Disallow older clients from connecting to the server.
Sorry for the delay, I see what you mean.
I don't think there's a robust solution for this, at least not in SFS1.x, since it doesn't support additional data to be sent at login time.
You could still verify if the client has already sent a version number, when an Extension request is received. If no value exists for such User you could do something about it. It's not ideal, but it might work.
In SFS2X this would be pretty easy to do, since the version could be sent at login time and stored as User property.
Cheers
I don't think there's a robust solution for this, at least not in SFS1.x, since it doesn't support additional data to be sent at login time.
You could still verify if the client has already sent a version number, when an Extension request is received. If no value exists for such User you could do something about it. It's not ideal, but it might work.
In SFS2X this would be pretty easy to do, since the version could be sent at login time and stored as User property.
Cheers
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 83 guests