Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a JSON RPC 2.0 client implementation over WebSockets. It can be used to communicate with a 0x Mesh node and add orders.
func NewClient ¶
NewClient creates and returns a new client. addr is the address of the server (i.e. a 0x Mesh node) to dial.
type RPCHandler ¶
type RPCHandler interface {
// AddOrder is called when the client sends an AddOrder request.
AddOrder(order *zeroex.SignedOrder) error
// AddPeer is called when the client sends an AddPeer request.
AddPeer(peerInfo peerstore.PeerInfo) error
}
RPCHandler is used to respond to incoming requests from the client.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a JSON RPC 2.0 server implementation over WebSockets. It accepts requests from a client for adding orders to the 0x Mesh network.
func NewServer ¶
func NewServer(addr string, rpcHandler RPCHandler) (*Server, error)
NewServer creates and returns a new server which will listen for new connections on the given addr and use the rpcHandler to handle incoming requests.
func (*Server) Addr ¶
Addr returns the address the server is listening on or nil if it has not yet started listening.