make_client | R Documentation |
Create client side thrift API
make_client(service, host = "localhost", port = 9090, proto_factory = TBinaryProtocolFactory$new(), trans_factory = TBufferedTransportFactory$new())
service |
parsed service |
host |
server host |
port |
server tcp port |
proto_factory |
factory that generates protocol implementation |
trans_factory |
factory that generates transport implementation |
## Not run: # File calc.thrift content: # service Calculator { # i32 add(1:i32 a, 2:i32 b); # i32 sub(1:i32 a, 2:i32 b); # i32 mult(1:i32 a, 2:i32 b); # i32 div(1:i32 a, 2:i32 b); # } # calc_thrift <- thriftr::t_load("calc.thrift", module_name="calc_thrift") cal <- thriftr::make_client( calc_thrift$Calculator, "127.0.0.1", 6000) a <- cal$mult(5, 2) b <- cal$sub(7, 3) c <- cal$sub(6, 4) d <- cal$mult(b, 10) e <- cal$add(a, d) f <- cal$div(e, c) print(f) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.