Demiurgic-JSON-RPC icon indicating copy to clipboard operation
Demiurgic-JSON-RPC copied to clipboard

Sync Process

Open oxxy opened this issue 11 years ago • 1 comments

Does it support Sync. process ? like calling a function that return a value from the service response and waiting the response to come back

  • (BOOL)checkUserExistence{ NSInteger callID;

    _jsonRPCService =[[DSJSONRPC alloc] initWithServiceEndpoint:[NSURL URLWithString:@"http://serv.m-diet.com/Persons.ashx"]];

    DSJSONRPCCompletionHandler completionHandler = ^(NSString *methodName, NSInteger callId, id methodResult, DSJSONRPCError *methodError, NSError *internalError) { if (methodError) { NSLog(@"\nMethod %@(%i) returned an error: %@\n\n", methodName, callId, methodError); return NO; } else if (internalError) { NSLog(@"\nMethod %@(%i) couldn't be sent with error: %@\n\n", methodName, callId, internalError); return NO; } else { NSLog(@"\nMethod %@(%i) completed with result: %@\n\n", methodName, callId, methodResult); NSMutableDictionary *responceDictionary = (NSMutableDictionary *)methodResult; return [[responceDictionary objectForKey:@"result"]boolValue]; } };

    callID = [_jsonRPCService callMethod:@"CheckPersonID" withParameters:@{ @"PersonID" : @"[email protected]"} onCompletion:completionHandler]; }

oxxy avatar Oct 01 '13 11:10 oxxy

The API does not support synchronous communication. However, you should be able to get that behavior using dispatch semaphores.

dbowen avatar Nov 28 '13 21:11 dbowen