rpc

package
v0.0.0-...-5a689ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2018 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package rpc is a client-only RPC package using websockets for javascript

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	ServiceMethod string
	Args, Reply   interface{}
	Error         error
	Done          chan *Call
}

Call represents the necessary data for an RPC call

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an RPC client

func Dial

func Dial(addr string) (*Client, error)

Dial connects a websocket to the given address and creates the client

func (*Client) Call

func (c *Client) Call(method string, args interface{}, reply interface{}) error

Call make an RPC request to the given method name

func (*Client) Close

func (c *Client) Close() error

Close closes the websocket - it does not currently do anything special with outstanding requests

func (*Client) Go

func (c *Client) Go(method string, args interface{}, reply interface{}, done chan *Call) *Call

Go makes an RPC request in a goroutine, returning a Call for the user to be notified upon completion and to retrieve any errors returned.

If a nil done chan is given, one will be created

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL