diff --git a/src/ios/SocketsForCordova/Classes/SocketAdapter.m b/src/ios/SocketsForCordova/Classes/SocketAdapter.m index dbe9f0e..5e3eecf 100644 --- a/src/ios/SocketsForCordova/Classes/SocketAdapter.m +++ b/src/ios/SocketsForCordova/Classes/SocketAdapter.m @@ -37,7 +37,6 @@ BOOL wasOpenned = FALSE; [inputStream open]; outputStream = (__bridge NSOutputStream *)writeStream; - //[outputStream setDelegate:self]; [outputStream open]; [self performSelectorOnMainThread:@selector(runReadLoop) withObject:nil waitUntilDone:NO]; @@ -125,13 +124,11 @@ BOOL wasOpenned = FALSE; case NSStreamEventHasBytesAvailable: { if(stream == inputStream) { uint8_t buf[65535]; - unsigned int len = 0; - - len = [inputStream read:buf maxLength:65535]; - NSLog(@"%d", len); + long len = [inputStream read:buf maxLength:65535]; + if(len > 0) { NSMutableArray *dataArray = [[NSMutableArray alloc] init]; - for (int i = 0; i < len; i++) { + for (long i = 0; i < len; i++) { [dataArray addObject:[NSNumber numberWithUnsignedChar:buf[i]]]; } @@ -184,6 +181,7 @@ BOOL wasOpenned = FALSE; } - (void)close { + self.closeEventHandler(FALSE); [self closeOutputStream]; [self closeInputStream]; } diff --git a/src/ios/SocketsForCordova/Classes/SocketPlugin.h b/src/ios/SocketsForCordova/Classes/SocketPlugin.h index 4bec071..7c1a02c 100644 --- a/src/ios/SocketsForCordova/Classes/SocketPlugin.h +++ b/src/ios/SocketsForCordova/Classes/SocketPlugin.h @@ -4,7 +4,6 @@ NSMutableDictionary *socketAdapters; } --(void) create: (CDVInvokedUrlCommand *) command; -(void) connect: (CDVInvokedUrlCommand *) command; -(void) write: (CDVInvokedUrlCommand *) command; -(void) close: (CDVInvokedUrlCommand *) command; diff --git a/src/ios/SocketsForCordova/Classes/SocketPlugin.m b/src/ios/SocketsForCordova/Classes/SocketPlugin.m index 20b254c..c24cd97 100644 --- a/src/ios/SocketsForCordova/Classes/SocketPlugin.m +++ b/src/ios/SocketsForCordova/Classes/SocketPlugin.m @@ -5,15 +5,6 @@ @implementation SocketPlugin : CDVPlugin -- (void) create : (CDVInvokedUrlCommand*) command { - //NSString* socketKey = [command.arguments objectAtIndex : 0]; - - - [self.commandDelegate - sendPluginResult: [CDVPluginResult resultWithStatus : CDVCommandStatus_OK] - callbackId: command.callbackId]; -} - - (void) connect : (CDVInvokedUrlCommand*) command { NSString *socketKey = [command.arguments objectAtIndex:0];