Categorygithub.com/go-micro/plugins/v3/codec/jsonrpc2
module
1.1.0
Repository: https://github.com/go-micro/plugins.git
Documentation: pkg.go.dev

# README

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/go-micro/plugins/v3/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),
    )

    // ...
}