I'm facing a very strange issue in fm.websync, behind Cyberroam connection.
This library connects to a websockets and onRecieve handler of that channel, recieves messages from server.
On any usual network, the websocket connection (HTTP101 request) remains persistent and I'm able to recieve messages.
Behind the firewall, the javascript code reaches the onSuccess handler of channel subscribe, bud no messages are recieved. On inspecting the chrome browser tab, I observe that the websocket connection request got to completed state (instead of being in pending state forever).
I realize that this is some issue with the firewall, and this question addresses it, but I was wondering if there's any approach to programmatically determine this state. Basically, to switch to http polling if websocket is not running properly.
One solution I could think of is to keep a global flag and set it to true in onRecieve handler. And also init a timeout function(2-3s) before channel subscribe to verify if flag is true, otherwise fallback. I'm looking forward to a neater and time-independent(lag indepentent) approach.