Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hakobera/msgpack-rpc-over-http-go

[Golang] client library for msgpack-rpc-over-http
https://github.com/hakobera/msgpack-rpc-over-http-go

Last synced: about 1 month ago
JSON representation

[Golang] client library for msgpack-rpc-over-http

Awesome Lists containing this project

README

        

# msgpack-rpc-over-http-go

Client library for [msgpack-rpc-over-http](https://github.com/authorNari/msgpack-rpc-over-http) for Go.

[![Build Status](https://travis-ci.org/hakobera/msgpack-rpc-over-http-go.svg?branch=master)](https://travis-ci.org/hakobera/msgpack-rpc-over-http-go)

## Install

```
$ go get github.com/hakobera/msgpack-rpc-over-http-go
```

## Usage

If server code is followings:

```ruby
require 'msgpack-rpc-over-http'
class MyHandler
def add(x,y) return x+y end
end

run MessagePack::RPCOverHTTP::Server.app(MyHandler.new)
```

Client code is like this:

```go
package main

import (
"fmt"
"os"
"github.com/hakobera/msgpack-rpc-over-http-go/overhttp"
)

func main() {
url := "http://localhost:9000"
opts := make(map[string]int32)
client := overhttp.NewMsgpackClient(url, &opts)

ret, err := client.Call("add", 1, 2)
if err != nil {
fmt.Printf("got %v", err)
os.Exit(1)
}

fmt.Printf("result is %v", ret)
}
```