1
// Copyright 2009 The Go Authors. All rights reserved.
2
// Copyright 2012 The Gorilla Authors. All rights reserved.
3
// Use of this source code is governed by a BSD-style
4
// license that can be found in the LICENSE file.
7
Package gorilla/rpc/json provides a codec for JSON-RPC over HTTP services.
9
To register the codec in a RPC server:
13
"code.google.com/p/gorilla/rpc"
14
"code.google.com/p/gorilla/rpc/json"
19
s.RegisterCodec(json.NewCodec(), "application/json")
21
http.Handle("/rpc", s)
24
A codec is tied to a content type. In the example above, the server will use
25
the JSON codec for requests with "application/json" as the value for the
26
"Content-Type" header.
28
This package follows the JSON-RPC 1.0 specification:
30
http://json-rpc.org/wiki/specification
35
The name of the method to be invoked, as a string in dotted notation
36
as in "Service.Method".
38
An array with a single object to pass as argument to the method.
40
The request id, a uint. It is used to match the response with the
41
request that it is replying to.
46
The Object that was returned by the invoked method,
47
or null in case there was an error invoking the method.
49
An Error object if there was an error invoking the method,
50
or null if there was no error.
52
The same id as the request it is responding to.
54
Check the gorilla/rpc documentation for more details:
56
http://gorilla-web.appspot.com/pkg/gorilla/rpc