relay

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	String() string

	Hello()

	TrySend(msg *NotificationTask) bool

	Disconnect()
}

type Dispatcher

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

func NewDispatcher

func NewDispatcher() *Dispatcher

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(user string, payload []byte)

func (*Dispatcher) Register

func (d *Dispatcher) Register(user string, client Client) *User

func (*Dispatcher) Run

func (d *Dispatcher) Run()

type NotificationTask

type NotificationTask struct {
	Id      uint64
	User    string
	Sent    *time.Time
	Payload []byte
}

func NewNotificationTask

func NewNotificationTask(id uint64, user string, payload []byte) *NotificationTask

type User

type User struct {
	Name string
	// contains filtered or unexported fields
}

func NewUser

func NewUser(name string) *User

func (*User) Ack

func (u *User) Ack(id uint64)

func (*User) Dispatch

func (u *User) Dispatch(payload json.RawMessage) error

func (*User) Join

func (u *User) Join(client Client)

func (*User) Leave

func (u *User) Leave(client Client)

func (*User) Run

func (u *User) Run()

Jump to

Keyboard shortcuts

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