mist

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package mist ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Publish

func Publish(tags []string, data string) error

todo: delete these 2. limiting what is a subscriber makes this not needed if they subscribe to a thing on a reused connection, they wanted to get updates.. hopefully

Publish publishes to ALL subscribers. Usefull in client applications who reuse the publish connection for subscribing (publishes to self)

func PublishAfter

func PublishAfter(tags []string, data string, delay time.Duration) error

PublishAfter publishes to ALL subscribers. Usefull in client applications who reuse the publish connection for subscribing

func Subscribers added in v1.1.1

func Subscribers() string

Subscribers is listall related

func Who added in v1.1.1

func Who() (int, int)

Who is who related

Types

type HandleFunc

type HandleFunc func(*Proxy, Message) error

HandleFunc ...

type Message

type Message struct {
	Command string   `json:"command"`
	Tags    []string `json:"tags,omitempty"`
	Data    string   `json:"data,omitempty"`
	Error   string   `json:"error,omitempty"`
}

A Message contains the tags used when subscribing, and the data that is being published through mist

type Node

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

Node ...

func (*Node) Add

func (node *Node) Add(keys []string)

Add sorts the keys and then attempts to add them

func (*Node) Match

func (node *Node) Match(keys []string) bool

Match sorts the keys and then attempts to find a match

func (*Node) Remove

func (node *Node) Remove(keys []string)

Remove sorts the keys and then attempts to remove them

func (*Node) ToSlice

func (node *Node) ToSlice() (list [][]string)

ToSlice recurses down an entire node returning a list of all branches and leaves as a slice of slices

type Proxy

type Proxy struct {
	sync.RWMutex

	Authenticated bool
	Pipe          chan Message
	// contains filtered or unexported fields
}

Proxy ...

func NewProxy

func NewProxy() (p *Proxy)

NewProxy ...

func (*Proxy) Close

func (p *Proxy) Close()

Close ...

func (*Proxy) List

func (p *Proxy) List() (data [][]string)

List returns a list of all current subscriptions

func (*Proxy) Publish

func (p *Proxy) Publish(tags []string, data string) error

Publish ...

func (*Proxy) PublishAfter

func (p *Proxy) PublishAfter(tags []string, data string, delay time.Duration)

PublishAfter sends a message after [delay]

func (*Proxy) Subscribe

func (p *Proxy) Subscribe(tags []string)

Subscribe ...

func (*Proxy) Unsubscribe

func (p *Proxy) Unsubscribe(tags []string)

Unsubscribe ...

Jump to

Keyboard shortcuts

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