Socket
Socket
Sign inDemoInstall

github.com/riftbit/jrpc2client

Package Overview
Dependencies
6
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/riftbit/jrpc2client

Package jrpc2client implements client for json-rpc 2.0 protocol and based on another packages: HTTP Client: github.com/valyala/fasthttp JSON Parser: github.com/pquerna/ffjson/ffjson Logger: github.com/sirupsen/logrus Errors: github.com/riftbit/jrpc2errors Example can be found only in client_test.go at this moment You can see your godoc rendered as HTML by running a local godoc server. This is great for previewing your godoc before committing changes. To do that, Make sure your code is in GOPATH and run: Go to http://localhost:8080/pkg and you should see your packages on the list. If you want the raw HTML, you can run:


Version published

Readme

Source

GoLang jrpc2client (early beta)

Website | Blog

license GoDoc Coverage Status Build Status Go Report Card

This is a json-rpc 2.0 client package for golang based on:

to get high perfomance

This package is still in development

Examples

Without custom logger settings

package main

import (
	"github.com/riftbit/jrpc2client"
)

type TestReply struct {
	LogID string `json:"log_id"`
}

func main() {
	client := jrpc2client.NewClient()

	client.SetBaseURL("http://127.0.0.1:65001")
	client.SetUserAgent("JsonRPC Test Client")
	client.SetBasicAuth("user", "password")

	dstT := &TestReply{}
	err := client.Call("/api", "demo.Test", TestArgs{ID: "TESTER_ID_1"}, dstT)
	if err != nil {
		panic(err)
	}
	println(dstT.LogID)
}

With custom logger settings

package main

import (
	"github.com/riftbit/jrpc2client"
)

type TestReply struct {
	LogID string `json:"log_id"`
}

func main() {
	logger := &logrus.Logger{
    		Out:       os.Stdout,
    		Formatter: &logrus.JSONFormatter{DisableTimestamp: false},
    		Level:     logrus.DebugLevel,
    }

    client := jrpc2client.NewClientWithLogger(logger)

    client.SetBaseURL("http://127.0.0.1:65001")
    client.SetUserAgent("JsonRPC Test Client")
    client.SetBasicAuth("user", "password")

    dstT := &TestReply{}
    err := client.Call("/api", "demo.Test", TestArgs{ID: "TESTER_ID_3"}, dstT)
    if err != nil {
    		panic(err)
    }
    println(dstT.LogID)
}

Benchmark results

FAQs

Last updated on 06 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc