Closed abillingsley closed 12 years ago
Did some initial digging around this one. It appears that opened is called prematurely in SSE. In the specific example above. SignalR returens a Server Error which is immediately written to the NSOutputStream, to the EventStreamReader this appears as if the stream was properly opened which causes the EventStreamReader to call open and the callbackInvoker to be invoked. Shortly after processing the data we get the callback from AFNetworking that the connection failed which is properly tries to call the callbackInvoker but it has already been invoked once and is therefore not invoked a second time.
The way in which we are using NSOutputStream for SSE is preventing the transport from falling back when it should.
An easy way to force transport failure is to change the value for kTransportName on the transport. This will call it to be "faulted" at which point the transport should fallback assuming there is a transport to fallback to.
Changing kTransportName to "serversentevents1" in the serverSentEvents Transport properly raises the faulted case but the transport is incorrectly initialized already so it does not notify the AutoTransport that it should fallback to LongPolling