[lib] Timeout for openSocket if onopen/onclose aren't called
[lib] Timeout for openSocket if onopen/onclose aren't called

Summary:
I encountered a strange issue where the iOS client got stuck in a state where it thought it was connecting, but the status didn't change for 30 seconds. At the time I remember having some issues with Wi-Fi (I was just outside of my home network's range), and I think I disabled Wi-Fi right before I foregrounded the app.

I couldn't reproduce the issue later, but I was able to look at a crash report I had manually triggered earlier. Based on the sequence of Redux actions in the crash report, and reading through the `Socket` code, I think I know what happened.

We currently don't have a timeout for when we call `openSocket`. We have a timeout for the request we send in `onopen`, but if the client calls neither `onopen` or `onclose`, the code in `Socket` will just be stuck.

This diff adds some timeout logic. After 3s it will show the "DISCONNECTED" bar, and after 5s it will terminate the connection and try again.

Reviewers: palys-swm

Reviewed By: palys-swm

Subscribers: KatPo, zrebcu411, Adrian

Differential Revision: https://phabricator.ashoat.com/D84

Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal