Simple yet extensible synchronous JSON-RPC client.

It's simple. Maybe so simple that it probably is not feature complete or even spec compliant. But it works for real world projects.

It's extensible because easily subclassable. Redefine one or all of the methods used in the process.

It's synchronous because sometime we know what we want and we know what we do. And we certainly know not to invoke a remote method on the main thread, right?


To run the - far from complete - tests, clone the repo, and run pod install from the Example directory before opening PCJSONRPC.xcworkspace.

Or, in one easy step, in a terminal:

$ pod try PCJSONRPC



#import <PCJSONRPC.h>

Create a JSON-RPC client

NSURL *url = [NSURL URLWithString:@""];
PCJSONRPC *jsonRPC = [[PCJSONRPC alloc] initWithURL:url];

Invoke a method

NSError *error;
NSString *hello = [jsonRPC invokeMethod:@"echo"

Define a protocol

@protocol EchoService
- (id)echo:(id)params error:(NSError **)error;

Create a proxy

id<EchoService> service =
    [jsonRPC proxyForProtocol:@protocol(EchoService)];

Invoke a method

hello = [service echo:@[@"World!"] error:&error];


Pierre-David Bélanger,


PCJSONRPC is available under the MIT license. See the LICENSE file for more info.