1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-05 10:20:53 +02:00
go-micro/plugins/codec/jsonrpc2
Jerry 93ba8cd0df
continue fix pre version go get bug that unknown v3.5.1 (#2188)
* 1.fix plugins go get bug.
2.update all mode.
3.add tidy tools

* continue fix pre version go get bug that unknown v3.5.1
2021-06-30 09:24:00 +01:00
..
client.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
errors.go add all the plugins 2020-12-26 15:32:45 +00:00
go.mod continue fix pre version go get bug that unknown v3.5.1 (#2188) 2021-06-30 09:24:00 +01:00
go.sum 1.fix plugins go get bug. (#2187) 2021-06-30 07:21:03 +01:00
jsonrpc2.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
license.go add all the plugins 2020-12-26 15:32:45 +00:00
README.md update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
server.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00

JSON-RPC 2.0 Codec

Usage

Import the codec and set within the client/server

package main

import (
    "github.com/asim/go-micro/v3"
    "github.com/micro/go-micro/client"
    "github.com/micro/go-micro/server"
    "github.com/asim/go-micro/plugins/codec/jsonrpc2"
)

func main() {
    client := client.NewClient(
        client.Codec("application/json", jsonrpc2.NewCodec),
        client.ContentType("application/json"),
    )

    server := server.NewServer(
        server.Codec("application/json", jsonrpc2.NewCodec),
    )

    service := micro.NewService(
        micro.Client(client),
        micro.Server(server),
    )

    // ...
}