mqtt

package module
v0.0.0-...-51015fe Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

func NewConnection

func NewConnection(conn websockets.Connection) *Connection

func (*Connection) Close

func (conn *Connection) Close()

func (*Connection) Read

func (conn *Connection) Read() (p []byte, err error)

func (*Connection) Write

func (conn *Connection) Write(p []byte) (err error)

type Request

type Request struct {
	Service string          `json:"service"`
	Fn      string          `json:"fn"`
	Header  http.Header     `json:"header"`
	Payload json.RawMessage `json:"payload"`
}

func (*Request) DeviceId

func (request *Request) DeviceId() (id string)

func (*Request) DeviceIp

func (request *Request) DeviceIp() (id string)

func (*Request) Validate

func (request *Request) Validate() (err error)

type Response

type Response struct {
	Succeed bool        `json:"succeed"`
	Payload interface{} `json:"result"`
}

func Failed

func Failed(err error) (resp *Response)

func Succeed

func Succeed(payload interface{}) (resp *Response)

func (*Response) Encode

func (resp *Response) Encode() (p []byte)

Jump to

Keyboard shortcuts

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