Closed DeepakArora76 closed 6 years ago
Another issue, is that the timeout for iOS is not respected. In the above sample, if I have a connection timeout of 6 seconds, then on iOS it takes more than a min + to see an errror.
You even documented information is wrong for iOS, specific to timeout! I do not find any reference to "Defaults to 60,0000ms on IOS" in the source code. Appreciate a link to that file.
Also, the timeout is in second: See below link. https://developer.apple.com/documentation/foundation/nsurlrequest/1416292-init?changes=_2
So, if I make a call to new WS(address, {timeout: 6}) on iOS, then it works. It times out after 6 secs.
Well first of all, the websocket will not auto-open if you are using the advanced interface this is documented in the https://github.com/NathanaelA/nativescript-websockets/blob/master/src/README.md#browser-based-websockets section. ONLY Browser based websockets auto-open to be identical to how the websockets on browsers behave. If you are choosing to use the advanced websockets; you control when to open it.
Second on the timeout; https://developer.apple.com/documentation/foundation/nsmutableurlrequest/1414063-timeoutinterval?changes=_2 ( 60 seconds = 60,000ms )
Third you are correct, timeouts are in seconds on iOS; I probably should make a note of that in the docs... I need to double check what they are on Android and I'll make sure to keep them the same. One of them might need to be converted to keep them in the same type (i.e. seconds or ms)
Thanks 👍
The behaviour can be seen on Android and iOS. With below code, I am unable see any logs, and that means the activity to open connection remain dormant / passive. If I add
this.websocket.open()
after the linenew WS(address, {timeout: 6000});
, I see that all the registered callbacks are triggered.Additional details: