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