I have found a very strange problem. We found that the time of establishing the websocket connection between mobile phone and server was too long. Then I use tcpdump to capture the data and found that the problem maybe has something to do with window scale option in SYN packet. Here is the SYN packet for websocket connection:
55488 → 443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=64 TSval=570815281 TSecr=0 SACK_PERM=1
But the server did not respond with ack. Then several retransmissions of SYN occured. Finally, the client sent a retransmission of SYN:
55488 → 443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1
Then the server responded with ack.
I also captured other data of HTTP connection and found that the window scale option in SYN packet for HTTP connection is "WS=128". No retransmission occurs in the handshake for HTTP connection.
So I just want to know the reason for it. The OS on our server is CentOS release 6.7. The version of kernel is 2.6.32-573.el6.x86_64.