I am developing a web application which gets images and videos from the mobile server. My application needs to show the link health to the mobile sever and alert the user if the linkage to the mobile server is broken. How can I do this using the JavaScript plugin?
Hi Eng Hock Koh
I could imagine at least three different cases.
1. When your user is not already connected and loged into the system.
You could make calls to “XPMobileSDK.connect” (or “Connect”) and “XPMobileSDK.disconnect” (or “Disconnect”).
If there is a fail you could change status.
You could do it pretty much faster (for example on every second) and in theory won’t heart Mobile server performance (too much).
2. When user is logged in.
You can use “XPMobileSDK.LiveMessage”.
It is used as “ping” to a server in order client to declare it is still alive.
SDK is doing it internally , but on bigger time intervals.
If there is a fail you could change status.
Again, You could do it pretty much faster (for example on every second) and in theory won’t heart Mobile server performance.
3. When user is logged in and is looking video stream.
In that case you could check how often you callback is called from the video channel. If it is not called for one-two seconds, you could display donut, progress bar or whatever overlay on the top of the video, indicating something is not completely okay with the video stream.
Please bear in mind that using solution for 2) in case of 3) could have client side performance drawback if video is running on AJAX.
This is because most of the browsers have a limitation for simultaneous connections to particular endpoint (something like 6 in most cases).
In that case if the end user(customer) is looking few video streams, making LiveMessage calls too often could decrease achieved in the web application stream fps.
If WebSockets are used (default setting in the SDK) this is not something that should be considered.
In that case however (WebSockets) you could notice other effects. Some of the browsers (especially in particular versions) do not distribute available bandwidth equal to all the open WebSockets. In result one video stream could achieve very good fps, but other to suffer too much. (We have seen situations where video 1 has fps of 30, but video 2, 3, 4, 5, 6 to have fps < 1). If you are in that particular case, implementing 3) could be tricky.