connection

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseResponse

func ParseResponse(r *Response) (int, string, map[string]interface{})

ParseResponse reads a response and returns data, which is more comfortable to use

Types

type Connection

type Connection struct {
	Ws   *websocket.Conn
	Key  string
	User string
	ID   int
}

Connection houses the current connection's details

func (*Connection) Call

func (c *Connection) Call(path, method string, message map[string]interface{}) int

Call a method on the target device

func (*Connection) Connect

func (c *Connection) Connect(addr string)

Connect to the specified host

func (*Connection) Disconnect

func (c *Connection) Disconnect()

Disconnect from the host

func (*Connection) List

func (c *Connection) List(namespace string) int

List available namespaces

func (*Connection) Recv

func (c *Connection) Recv() Response

Recv reads a json response into a response struct

func (*Connection) Send

func (c *Connection) Send(request interface{}) int

Send the specified interface{} as json

type Response

type Response struct {
	ID      int
	Result  []interface{}
	Jsonrpc string
}

Response from server is stored in this struct

Jump to

Keyboard shortcuts

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