NathanaelA / nativescript-websockets

Websockets for NativeScript
83 stars 43 forks source link

Connection cancels on iOS after upgrade to tns 5.X #63

Closed Adelrisk closed 3 years ago

Adelrisk commented 5 years ago

EDIT: see below for an update of a further investigation. tl;dr: The problem is caused by a number of as-yet-unknown app specific dependencies and/or code, in addition to Nativescript 5.X.

A low-level error is preventing me from upgrading an existing app to Nativescript 5, which causes me to contemplate questions.

After upgrading from Nativescript 4.2 to 5 (and again recently 5.2), everything in the app appears to work as before, except a new behaviour occurs when using the Websockets: they cancel unexpectedly without explanation.

TCP Conn 0x2809af900 canceled
[C2 Hostname#88d08305:443 tcp, legacy-socket] cancel
[C2 Hostname#88d08305:443 tcp, legacy-socket] cancelled
[C2.1 <private> 192.168.178.111:51863<->IPv4#02d701df:443]
Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns
Duration: 2.064s, DNS @0.001s took 0.002s, TCP @0.004s took 0.034s
bytes in/out: 3931/1022, packets in/out: 8/6, rtt: 0.045s, retransmitted packets: 0, out-of-order packets: 0
0.000s [C2 <private> Hostname#88d08305:443 resolver] path:start
0.000s [C2 <private> Hostname#88d08305:443 resolver] path:satisfied
0.001s [C2 <private> Hostname#88d08305:443 resolver] resolver:start_dns
0.003s [C2 <private> Hostname#88d08305:443 resolver] resolver:receive_dns
0.003s [C2.1 <private> 192.168.178.111:51863<->IPv4#02d701df:443 socket-flow] path:start
0.004s [C2.1 <private> 192.168.178.111:51863<->IPv4#02d701df:443 socket-flow] path:satisfied
0.004s [C2.1 <private> 192.168.178.111:51863<->IPv4#02d701df:443 socket-flow] flow:start_connect
0.037s [C2.1 <private> 192.168.178.111:51863<->IPv4#02d701df:443 socket-flow] flow:finish_connect
0.038s [C2 <private> Hostname#88d08305:443 resolver] flow:finish_connect
0.038s [C2.1 <private> 192.168.178.111:51863<->IPv4#02d701df:443 socket-flow] flow:changed_viability
0.038s [C2 <private> Hostname#88d08305:443 resolver] flow:changed_viability
2.064s [C2] path:cancel
nw_endpoint_flow_protocol_disconnected [C2.1 IPv4#02d701df:443 cancelled socket-flow (null)] Output protocol disconnected
nw_connection_report_state_with_handler_locked [C2] reporting state cancelled

This occurs very consistently and reproducibly, and does not happen when I don't upgrade Nativescript. Any clues how I might make progress on this problem?

UPDATE:

Adelrisk commented 5 years ago

This problem exists for version 1.5.1 and 1.5.3.

Btw, there is no propagation of an error by the Nativescript instance. No callbacks are triggered and no (Javascript) error is reported.

romandrahan commented 5 years ago

@Adelrisk @NathanaelA the same for me 👆

NathanaelA commented 5 years ago

Thank you for reporting the issue. Just to set the expectation; Unfortunately, I have like zero unpaid free time right now to investigate why it is not working at this point. All my "unpaid" time is currently going to several other projects that I am currently trying to finish.

If someone's company wants to sponsor the time to fix this (send me an email) -- or if anyone wants to trace down the issue, I will gladly take PR's. Otherwise it will probably be at least a few weeks before I might have any time to look into this issue.

legion151 commented 4 years ago

any news on this? we're now on tns v6.3.3 - and this just happend...

legion151 commented 4 years ago

82 kinda solves this by using ios native sockets - which are availabe from ios 13 on.

NathanaelA commented 3 years ago

I basically merged your PR into v2.0, however I did ALSO test PocketSocket on iOS 14.7 and had no issues with NS v8.0