I use SocketIO project on my iOS app to connect to my node.js server and 
everything works great until I choose to connect to facebook. When I connect to 
Facebook I send some data to my server and he answer with some data like "user 
already connected, user created in database" etc. And after that, my 
NSInputStream seems to be at 0 and so my connexion is closed. I don't know what 
to do, I spent 14 hours on that and still get this issue...

Can you help me with ?
Looks like the problem is in SRWebSocket.m line 1462

There is the code in fault :

            case NSStreamEventEndEncountered: {
                [self _pumpScanner];
                SRFastLog(@"NSStreamEventEndEncountered %@", aStream);
                if (aStream.streamError) {
                    [self _failWithError:aStream.streamError];
                } else {
                    if (self.readyState != SR_CLOSED) {
                        self.readyState = SR_CLOSED;
                        _selfRetain = nil;
                    }

                    if (!_sentClose && !_failed) {
                        _sentClose = YES;
                        // If we get closed in this state it's probably not 
clean because we should be sending this when we send messages
                        [self _performDelegateBlock:^{
                            if ([self.delegate 
respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) {
                                [self.delegate webSocket:self 
didCloseWithCode:0 reason:@"Stream end encountered" wasClean:NO];
                            }
                        }];
                    }
                }
                
                break;
            }
                
            case NSStreamEventHasBytesAvailable: {
                SRFastLog(@"NSStreamEventHasBytesAvailable %@", aStream);
                const int bufferSize = 2048;
                uint8_t buffer[bufferSize];
                
                while (_inputStream.hasBytesAvailable) {

                    int bytes_read = [_inputStream read:buffer 
maxLength:bufferSize];
                    
                    if (bytes_read > 0) {
                        [_readBuffer appendBytes:buffer length:bytes_read];
                    } else if (bytes_read < 0) {
                        [self _failWithError:_inputStream.streamError];
                    }
                    
                    if (bytes_read != bufferSize) {
                        break;
                    }
                };
                [self _pumpScanner];
                break;
            }

And the result from my server (initalLogin = yes connexion is good you can 
continue) :

onData 
5:::{"name":"initalLogin","args":[{"guid":"af78bdf0-f17d-ede2-7dd6-22708d1330f7","usedWithFaceBook":true}]}

start/reset timeout
NSStreamEventEndEncountered <__NSCFInputStream: 0xab21660>
onDisconnect ()

DECONNEXION = The operation couldn’t be completed. (SocketIOError error -4.)

Can you help me with ?

Thanks in advance.

Vavelin Kévin
Twitter | Blog | LinkedIn 
Entrepreneur
Developer OS X / iOS

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to