saas_event_basic

package
v0.0.0-...-67e3d2d Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Id   string      `json:"id"`
	Data interface{} `json:"data"`
}

type Event

type Event struct {
	Hub saas_event.Hub
	*sync.RWMutex
}

func (*Event) Broadcast

func (event *Event) Broadcast(channel string, id string, data interface{})

func (*Event) GetHub

func (event *Event) GetHub() saas_event.Hub

func (*Event) Listen

func (event *Event) Listen(userId uint, clientId uint) chan sse.Event

func (*Event) NewClientId

func (event *Event) NewClientId() uint

func (*Event) Subscribe

func (event *Event) Subscribe(userId uint, clientId uint)

func (*Event) Trigger

func (event *Event) Trigger(userId uint, channel string, id string, data interface{})

func (*Event) Unsubscribe

func (event *Event) Unsubscribe(userId uint, clientId uint)

type Hub

type Hub struct {
	List map[uint]map[uint]chan sse.Event
	*sync.RWMutex
}

func (*Hub) DeleteClient

func (hub *Hub) DeleteClient(userId uint, clientId uint)

func (*Hub) GetClient

func (hub *Hub) GetClient(userId uint, clientId uint) chan sse.Event

func (*Hub) GetList

func (hub *Hub) GetList() map[uint]map[uint]chan sse.Event

func (*Hub) GetUser

func (hub *Hub) GetUser(userId uint) map[uint]chan sse.Event

func (*Hub) Init

func (hub *Hub) Init() saas_event.Hub

func (*Hub) NewClient

func (hub *Hub) NewClient(userId uint, clientId uint)

Jump to

Keyboard shortcuts

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