extension

package
v0.0.0-...-6e21248 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

libmqtt Extension

Extensions for libmqtt client

Extension List

  • Persist Extension
    1. RedisPersist (Test) - Use redis as session state persist storage
  • Router Extension
    1. HttpRouter (TODO) - HTTP path router for MQTT message

Usage

  1. Go get extension package
go get github.com/goiiot/libmqtt/extension
  1. Import extensions
import "github.com/goiiot/libmqtt/extension"

LICENSE

Copyright Go-IIoT (https://github.com/goiiot)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBoltPersist

func NewBoltPersist(bucket *bolt.Bucket) mqtt.PersistMethod

NewBoltPersist creates a new boltPersist for session persist with provided bucket

func NewEtcdPersist

func NewEtcdPersist(client *clientv3.Client) mqtt.PersistMethod

NewEtcdPersist creates a new EtcdPersist for session persist with provided etcd client

func NewRedisPersist

func NewRedisPersist(conn *redis.Client, mainKey string) mqtt.PersistMethod

NewRedisPersist creates a new redisPersist for session persist with provided redis connection and mainKey,

if mainKey is empty here, the default mainKey "libmqtt" will be used if no redis client (nil) provided, will return nil

Types

type EtcdPersist

type EtcdPersist struct {
}

func (*EtcdPersist) Delete

func (r *EtcdPersist) Delete(key string) error

func (*EtcdPersist) Destroy

func (r *EtcdPersist) Destroy() error

func (*EtcdPersist) Load

func (r *EtcdPersist) Load(key string) (mqtt.Packet, bool)

func (*EtcdPersist) Name

func (r *EtcdPersist) Name() string

Name of redisPersist is "EtcdPersist"

func (*EtcdPersist) Range

func (r *EtcdPersist) Range(f func(string, mqtt.Packet) bool)

func (*EtcdPersist) Store

func (r *EtcdPersist) Store(key string, p mqtt.Packet) error

type HttpRouter

type HttpRouter struct {
}

HttpRouter is a HTTP URL style router

func (*HttpRouter) Dispatch

func (r *HttpRouter) Dispatch(p *mqtt.PublishPacket)

Dispatch the received packet

func (*HttpRouter) Handle

func (r *HttpRouter) Handle(topic string, h mqtt.TopicHandler)

Handle the topic with TopicHandler h

func (*HttpRouter) Name

func (r *HttpRouter) Name() string

Name of HttpRouter is "HttpRouter"

Jump to

Keyboard shortcuts

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