emq

package
v0.0.0-...-15f75d5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(cfg Config) mqtt.Client

Types

type Config

type Config struct {
	ClientID string `koanf:"client_id"`
	URL      string `koanf:"url"`
}

type Emq

type Emq struct {
	Client mqtt.Client
	Logger *zap.Logger
}

func (Emq) Publish

func (e Emq) Publish(topic string, data interface{})

func (Emq) Subscribe

func (e Emq) Subscribe(topic string, callback mqtt.MessageHandler)

type Event

type Event struct {
	Type    EventType   `json:"type,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
}

type EventType

type EventType string
const (
	RoomCreated EventType = "room-created"
	RoomDeleted EventType = "room-deleted"
	JoinRoom    EventType = "join-room"
)

Jump to

Keyboard shortcuts

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