O'Reilly logo

Go Standard Library Cookbook by Radomir Sohlich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Go's standard library implements JSON-RPC 1.0 as part of its built-in packages. The jsonrpc package implements the function Dial, which produces the client for calling remote procedures. The client itself contains the Call method, which accepts the procedure call, arguments, and the pointer where the result is stored.

The createServer will create a sample server to test the client call.

The HTTP protocol can be used as a transport layer for JSON-RPC. The net/rpc package contains the DialHTTP function, which is able to create the client and call the remote procedures.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required