All blocking calls in ios plugin now runs in background thread.
This commit is contained in:
		@@ -66,6 +66,7 @@
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
	SocketAdapter *socket = [self getSocketAdapter:socketKey];
 | 
						SocketAdapter *socket = [self getSocketAdapter:socketKey];
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    [self.commandDelegate runInBackground:^{
 | 
				
			||||||
        @try {
 | 
					        @try {
 | 
				
			||||||
            [socket connect:host port:port];
 | 
					            [socket connect:host port:port];
 | 
				
			||||||
            [self.commandDelegate
 | 
					            [self.commandDelegate
 | 
				
			||||||
@@ -77,6 +78,7 @@
 | 
				
			|||||||
             sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:e.reason]
 | 
					             sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:e.reason]
 | 
				
			||||||
             callbackId:command.callbackId];
 | 
					             callbackId:command.callbackId];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void) write:(CDVInvokedUrlCommand *) command {
 | 
					- (void) write:(CDVInvokedUrlCommand *) command {
 | 
				
			||||||
@@ -86,6 +88,7 @@
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    SocketAdapter *socket = [self getSocketAdapter:socketKey];
 | 
					    SocketAdapter *socket = [self getSocketAdapter:socketKey];
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
						[self.commandDelegate runInBackground:^{
 | 
				
			||||||
        @try {
 | 
					        @try {
 | 
				
			||||||
            [socket write:data];
 | 
					            [socket write:data];
 | 
				
			||||||
            [self.commandDelegate
 | 
					            [self.commandDelegate
 | 
				
			||||||
@@ -97,6 +100,7 @@
 | 
				
			|||||||
             sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:e.reason]
 | 
					             sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:e.reason]
 | 
				
			||||||
             callbackId:command.callbackId];
 | 
					             callbackId:command.callbackId];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void) close:(CDVInvokedUrlCommand *) command {
 | 
					- (void) close:(CDVInvokedUrlCommand *) command {
 | 
				
			||||||
@@ -105,6 +109,7 @@
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	SocketAdapter *socket = [self getSocketAdapter:socketKey];
 | 
						SocketAdapter *socket = [self getSocketAdapter:socketKey];
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    [self.commandDelegate runInBackground:^{
 | 
				
			||||||
        @try {
 | 
					        @try {
 | 
				
			||||||
            [socket close];
 | 
					            [socket close];
 | 
				
			||||||
            [self.commandDelegate
 | 
					            [self.commandDelegate
 | 
				
			||||||
@@ -116,6 +121,7 @@
 | 
				
			|||||||
             sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:e.reason]
 | 
					             sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:e.reason]
 | 
				
			||||||
             callbackId:command.callbackId];
 | 
					             callbackId:command.callbackId];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void) setOptions: (CDVInvokedUrlCommand *) command {
 | 
					- (void) setOptions: (CDVInvokedUrlCommand *) command {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user