broker

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectCodeLength = 8
View Source
const JobNamespace = "automuteus:jobs:"
View Source
const JobTTLSeconds = 3600

Variables

This section is empty.

Functions

func Ack

func Ack(ctx context.Context, redis *redis.Client, connCode string)

func AckSubscribe

func AckSubscribe(ctx context.Context, redis *redis.Client, connCode string) *redis.PubSub

func PushJob

func PushJob(ctx context.Context, redis *redis.Client, connCode string, jobType JobType, payload string) error

func Subscribe

func Subscribe(ctx context.Context, redis *redis.Client, connCode string) *redis.PubSub

Types

type Broker

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

func NewBroker

func NewBroker(redisAddr, redisUser, redisPass string) *Broker

func (*Broker) AckWorker

func (broker *Broker) AckWorker(ctx context.Context, connCode string, killChan <-chan bool)

anytime a bot "acks", then push a notification

func (*Broker) Start

func (broker *Broker) Start(port string)

type Job

type Job struct {
	JobType JobType     `json:"type"`
	Payload interface{} `json:"payload"`
}

func PopJob

func PopJob(ctx context.Context, redis *redis.Client, connCode string) (Job, error)

type JobType

type JobType int
const (
	Connection JobType = iota
	Lobby
	State
	Player
)

Jump to

Keyboard shortcuts

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