core

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package core ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Subscribers

func Subscribers() string

Subscribers is listall related

func Who

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 is a data structure used for storing subscriptions

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