Skip to content
MessagePack-RPC for D
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/with_http_server
src/msgpackrpc
LICENSE.txt Update README and add LICENSE Feb 3, 2013
README.md
package.json fix #19 Jan 10, 2019
posix.mak

README.md

MessagePack RPC for D

MessagePack RPC implementation based on vibe.d

Example

Client

auto client = new TCPClient(Endpoint(18800, "127.0.0.1"));

// sync request
auto num = client.call!ulong("sum", 1, 2);

// async request: return a Future object
auto future = client.callAsync("sum", 1, 2);

// notify
client.notify("hello", "hoge");

Server

Object

class FooServer
{
    ulong sum(ulong l, ulong r)
    {
        return l + r;
    }

    void hello(string msg)
    {   
        writeln(msg);
    }
}

// TCPServer or UDPServer
auto server = new TCPServer!(FooServer)(new FooServer);
server.listen(Endpoint(18800, "127.0.0.1"));
server.start();

module

module foo;

ulong sum(ulong l, ulong r)
{
    return l + r;
}

void hello(string msg)
{   
    writeln(msg);
}

auto server = new TCPServer!(foo)();
// same as Object

Link

Copyright

AuthorMasahiro Nakagawa
CopyrightCopyright (c) 2013- Masahiro Nakagawa
LicenseMIT License
You can’t perform that action at this time.