DyKnow / SignalR-ObjC

Objective-C Client for the SignalR Project works with iOS and Mac
MIT License
442 stars 213 forks source link

Connection failed to reconnect despite start transport was successful #302

Open aliaksandrvarabyou opened 5 years ago

aliaksandrvarabyou commented 5 years ago

Hi, in our system we have issue with reconnect - in some cases whole request string length could be greater than allowed at server (2048 now) and 400 error appears. So we've decided to avoid reconnect at all and always use connect request. To achieve this we call 'stop' for connection when him state changed to 'reconnecting', and after 1 second call 'start''. All seems work fine but disconnectTimeoutOperation not cancelled after connection started and reconnect timeout triggered. This happens because in webSocketDidOpen of SRWebSocketTransport transfer to the 'connected' state is possible only if current state is 'reconnecting' , but we have 'connecting' after stop/start. We've fix this with manual call of 'didReconnect' after connection state did change to 'connected', but it looks like dirty hack. Can you please advise something? Many thanks.

joeldart commented 5 years ago

this sounds vaguely familiar and possibly handled in some work done on an internal branch - feature-closeOnTimeout We've been pointing our internal spec on

s.source     = { :git => 'https://github.com/DyKnow/SignalR-ObjC.git', :commit => '6550e5e205443b9356f6ae809df3b6eb6c79a798' }

for about 7 months now based on some fixes we identified (but hadnt yet published as a new version). that state transition sounds familiar enough you might try if it was fixed there.