Skip to content
DNode ObjectiveC implementation for OSX and iOS
Objective-C JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

DNode | ObjectiveC implementation for OSX and iOS

An Objective-C native implementation of dnode asynchronous RPC protocol. It uses the following library


Start by subclassing DNode and define your local dnode interface in a header file.

#import "DNode.h"

@interface TestClient : DNode
-(void)foo; //the method your would like to call on remote

To expose your local dnode interface to the remote, use C++ macro DEFINE_CLIENT_METHOD(local_name). For example

//the direct call from remote dnode
    NSLog(@"hello from server: %@ ", args); 

To explicitly declare a method on remote and receive callback, use DEFINE_SERVER_METHOD_WITH_CALLBACK(remote_name)

//the callback from a previous local-to-remote call
    NSLog(@"callback from server %@", args);

To invoke a method on remote, use CALL_SERVER_METHOD(remote_name, arg) whose remote_name must match the name defined in DEFINE_SERVER_METHOD_WITH_CALLBACK. For example

    id arg = @[@"hello from client"];
    CALL_SERVER_METHOD(echo, arg);

To create a dnode instance and connect to a remote

TestClient* client = [[TestClient alloc] init];
[client connectToHost:@"" Port:8000 Callback:^(BOOL success, NSNumber* err){
        NSLog(@"connected %d with err %@", success, err);

Set up a delegate object to get notified on connection status

[client addListener:self CallbackQueue:dispatch_get_main_queue()];

A number of delegate callbacks are

-(void)connectSuccess; //connected to remote
-(void)remoteReady; //remote interface ready

For details please look into the test directory for OSX and iOS demo projects.


Denny C. Dai or visit

Task List

  • local listening server that receives remote connection
  • callback to remote from a previous remote-to-local invocation
  • more unit testing and examples


The MIT License

You can’t perform that action at this time.