Hello,
HRC is not supported by Smartfox.
http://docs2x.smartfoxserver.com/Gettin ... eb-sockets
is there any other option on HRC?
Thanks
HRC in HTML5 Connection_resume
-
- Posts: 3
- Joined: 20 Aug 2013, 14:16
Re: HRC in HTML5 Connection_resume
Basic auto-reconnect can be implemented by listening to the disconnection event and restarting a connection after a few seconds (e.g. 5secs)
-
- Posts: 3
- Joined: 20 Aug 2013, 14:16
Re: HRC in HTML5 Connection_resume
Hi,
Thanks for your reply.
I hope i was not able to clarify my question very well.
Elaborating again. I am planning to make a html5 based poker game. whats the issue coming to me that when a user joins a game ( room ) and starts playing but say after some time the connection gets disconnected. I want to retain the same state where the user was before disconnecting when user joins again.
But the issue what i am facing is that as html 5 does not supports HRC ( resume connection ) feature i am not able to get the current state of the user when he was disconnected.
Please advice how should i implement it.
Thanks,
- Arunesh
Thanks for your reply.
I hope i was not able to clarify my question very well.
Elaborating again. I am planning to make a html5 based poker game. whats the issue coming to me that when a user joins a game ( room ) and starts playing but say after some time the connection gets disconnected. I want to retain the same state where the user was before disconnecting when user joins again.
But the issue what i am facing is that as html 5 does not supports HRC ( resume connection ) feature i am not able to get the current state of the user when he was disconnected.
Please advice how should i implement it.
Thanks,
- Arunesh
Re: HRC in HTML5 Connection_resume
Hi there,
You can achieve the same behavior of the HRC system by using a server-side extension.
When the user logs in, you generate an unique random key, attach it to the user and send it back to the client.
When an user is disconnected, you store the reference to the User object on the extension for some limited time.
On the client, when you are disconnected, you either show a "reconnect" button or reconnect automatically.
When you're going to reconnect, you send a new LoginRequest but this time you send the unique random key that you received on the previous session on the extra parameters.
On the extension, where you handle the custom login, you check if there's a valid User object with the provided random key. If there is, then you "transfer" the data from that "old" User object to the new one, such as the UserVariables, joining the same room, etc. At this time you also remove the old User object so that that string can't be re-used.
Hope this helps
You can achieve the same behavior of the HRC system by using a server-side extension.
When the user logs in, you generate an unique random key, attach it to the user and send it back to the client.
When an user is disconnected, you store the reference to the User object on the extension for some limited time.
On the client, when you are disconnected, you either show a "reconnect" button or reconnect automatically.
When you're going to reconnect, you send a new LoginRequest but this time you send the unique random key that you received on the previous session on the extra parameters.
On the extension, where you handle the custom login, you check if there's a valid User object with the provided random key. If there is, then you "transfer" the data from that "old" User object to the new one, such as the UserVariables, joining the same room, etc. At this time you also remove the old User object so that that string can't be re-used.
Hope this helps
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Return to “SFS2X HTML5 / JavaScript API”
Who is online
Users browsing this forum: No registered users and 27 guests