RTC Forums
November 21, 2024, 12:42:52 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
Handling losing the server
Pages: [
1
]
« previous
next »
Print
Author
Topic: Handling losing the server (Read 4195 times)
DPerkins
RTC License
Posts: 37
Handling losing the server
«
on:
June 13, 2022, 11:43:35 AM »
I'd like to add some resilience to my client application by adding an offline-mode.
We sometimes have an issue where our RTC server is not available (server crash, internet connection, ransomware etc) and would like our client application to detect this, halt all server requests, and upload collected data once the server is back online.
My plan is to reduce the request timeouts for short/simple requests (so that the user doesn't notice a 30 second timeout pause) and flag as 'offline' if any of these requests fail. In the background, I would then periodically check for the server's presence and set the offline flag once the server is available again. This would trigger cached data to be uploaded.
Is there a standard way of detecting server disappearence with minimal delays/timeouts affecting the user?
Many thanks.
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Handling losing the server
«
Reply #1 on:
June 14, 2022, 02:08:50 AM »
The simplest way for a Client to check if a Server is accessible, would be to send a request to that Server and wait for a response, but you probably know that already.
If your Clients are implemented using the RTC SDK, you can set
AutoConnect
and
ReconnectOn
properties to TRUE on your
TRtcHttpClient
components, then you don't have to manually call Connect when a connection is needed.
For continuous retries in case of a failure, implement the
OnRepostCheck
event on your
TRtcDataRequest
component. That event will be triggered if a request failed. Calling TRtcDataClient(Sender).
Request.Repost
from that event tells the component to try sending the last request to the Server again. Should there be another failure, the same event would be triggered again.
I guess, you already know how to work with these components, but ... if you need an example for using the properties and events I've mentioned here, check the File_Client Project in the
Examples/File_Client
folder. It doesn't implement exactly what you want, but it shows you how connection errors and request failures can be handled with the RTC SDK.
Best Regards,
Danijel Tkalcec
Logged
DPerkins
RTC License
Posts: 37
Re: Handling losing the server
«
Reply #2 on:
June 14, 2022, 11:30:03 AM »
Thanks Danijel
I have AutoConnect set to true, but the default for ReconnectOn. I'll change that.
Any downtime could be significant (hours) so I plan on blocking all comms until I'm sure the connection is established again rather than retrying individual requests.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...