All Projects → visionmedia → go-hpc

visionmedia / go-hpc

Licence: other
HTTP RPC codec for Gorilla RPC v2.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-hpc

cannon
Lightning fast data serialization and RPC for Crystal
Stars: ✭ 56 (+93.1%)
Mutual labels:  rpc
InterProcessCommunication
Inter-process Communication
Stars: ✭ 11 (-62.07%)
Mutual labels:  rpc
jsonrpcpp
C++ JSON-RPC 2.0 library
Stars: ✭ 97 (+234.48%)
Mutual labels:  rpc
server
Implement the JSON-RPC 2.0 server specification for @laravel.
Stars: ✭ 154 (+431.03%)
Mutual labels:  rpc
bifrost
Communications library & daemon for Go. Modular transports, links, pubsub (NATS), quic-over-websocket, libp2p, RPC, encryption, testing, and more.
Stars: ✭ 63 (+117.24%)
Mutual labels:  rpc
zerorpc-dotnet
A .NET implementation of ZeroRPC
Stars: ✭ 21 (-27.59%)
Mutual labels:  rpc
yar-c
Yar C Framework
Stars: ✭ 107 (+268.97%)
Mutual labels:  rpc
litchi
这是一款分布式的java游戏服务器框架
Stars: ✭ 97 (+234.48%)
Mutual labels:  rpc
hprose-as3
Hprose for ActionScript 3.0
Stars: ✭ 18 (-37.93%)
Mutual labels:  rpc
pytezos
🐍 Python SDK & CLI for Tezos | Michelson REPL and testing framework
Stars: ✭ 93 (+220.69%)
Mutual labels:  rpc
wsapix
Next generation Websocket framework for nodejs
Stars: ✭ 17 (-41.38%)
Mutual labels:  rpc
twjitm-core
采用Netty信息加载实现长连接实时通讯系统,客户端可以值任何场景,支持实时http通讯、webSocket通讯、tcp协议通讯、和udp协议通讯、广播协议等 通过http协议,rpc协议。 采用自定义网络数据包结构, 实现自定义网络栈。
Stars: ✭ 98 (+237.93%)
Mutual labels:  rpc
drpc
drpc is a lightweight, drop-in replacement for gRPC
Stars: ✭ 1,014 (+3396.55%)
Mutual labels:  rpc
rpc ts
Remote Procedure Calls in TypeScript made simple 🤞
Stars: ✭ 71 (+144.83%)
Mutual labels:  rpc
RPC
RPC is a highly available pluggable architecture for remote calls
Stars: ✭ 31 (+6.9%)
Mutual labels:  rpc
impress-cli
Impress Application Server Command line interface
Stars: ✭ 25 (-13.79%)
Mutual labels:  rpc
irmin-rpc
RPC client/server for Irmin
Stars: ✭ 20 (-31.03%)
Mutual labels:  rpc
ethereum-client
ethereum rpc client
Stars: ✭ 34 (+17.24%)
Mutual labels:  rpc
cli
Command Line Interface for @imqueue
Stars: ✭ 20 (-31.03%)
Mutual labels:  rpc
remote-lib
💫 Convert your JavaScript library to a remote service.
Stars: ✭ 40 (+37.93%)
Mutual labels:  rpc

GoDoc Build Status

go-hpc

HPC is a Gorilla RPC v2 Codec that allows you to perform RPC-like requests using the pathname for the service and method, leaving the bodies for requests and responses.

This differs from JSON-RPC which uses a JSON body envelope. This package also hides the "Go-isms" by transforming snake-case to camel-case, for example "/files/list_all" would invoke Files.ListAll().

Example

Service:

package hpc_test

import (
  "log"
  "net/http"
  "strings"

  "github.com/gorilla/rpc/v2"
  "github.com/tj/go-hpc"
)

type Users struct {
  users []string
}

type ListInput struct {
  Prefix string `json:"prefix"`
}

type ListOutput struct {
  Names []string `json:"names"`
}

func (u *Users) List(r *http.Request, in *ListInput, out *ListOutput) error {
  out.Names = []string{}
  for _, name := range u.users {
    if strings.HasPrefix(name, in.Prefix) {
      out.Names = append(out.Names, name)
    }
  }
  return nil
}

func Example() {
  users := []string{"Tobi", "Loki", "Jane"}

  r := rpc.NewServer()
  r.RegisterCodec(hpc.NewCodec(), "application/json")
  r.RegisterService(&Users{users}, "")

  http.Handle("/", r)
  log.Fatalln(http.ListenAndServe(":3000", nil))
}

Request:

$ curl -d '{ "prefix": "T" }' -H "Content-Type: application/json" http://localhost:3000/users/list
{
  "names": ["Tobi"]
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].