redishandler

package
v0.0.0-...-bc28a72 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisHandler

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

RedisHandler responsible for handling communications with redis And some helping functions

func GetRedisHandler

func GetRedisHandler() *RedisHandler

GetRedisHandler - Get unique redis handler instance

func NewRedisHandler

func NewRedisHandler() *RedisHandler

NewRedisHandler instiantiate a new RedisHandler

func (*RedisHandler) ClientConnected

func (handler *RedisHandler) ClientConnected(clientID string)

ClientConnected publish an event warning others that this client connected

func (*RedisHandler) DeleteUserQueues

func (handler *RedisHandler) DeleteUserQueues(clientID string)

DeleteUserQueues of the given clientID

func (*RedisHandler) EnqueueMessage

func (handler *RedisHandler) EnqueueMessage(clientID string, message []byte) bool

EnqueueMessage into the waiting messages queue of this user if the user devices aren't in redis Then a fetch request will be sent

func (*RedisHandler) FetchMessage

func (handler *RedisHandler) FetchMessage(clientID string, deviceID string) []byte

FetchMessage from the user queue

func (*RedisHandler) GetUsersOnlineStatus

func (handler *RedisHandler) GetUsersOnlineStatus(clientIDs []string) map[string]string

GetUsersOnlineStatus from the the given clientIDs

func (*RedisHandler) MessageAck

func (handler *RedisHandler) MessageAck(clientID string, deviceID string)

MessageAck remove ack message from processing queue

func (*RedisHandler) NoAckReceived

func (handler *RedisHandler) NoAckReceived(clientID string, deviceID string)

NoAckReceived send not ack message back to waiting queue

func (*RedisHandler) Publish

func (handler *RedisHandler) Publish(channel string, message []byte)

Publish an event

func (*RedisHandler) Subscribe

func (handler *RedisHandler) Subscribe(channel string) *redis.PubSub

Subscribe to a specific channel

func (*RedisHandler) Unsubscribe

func (handler *RedisHandler) Unsubscribe(channel string, pubSubHandler *redis.PubSub)

Unsubscribe a specific channel

func (*RedisHandler) UpdateHeartBeat

func (handler *RedisHandler) UpdateHeartBeat(clientID string)

UpdateHeartBeat of a connected client

Jump to

Keyboard shortcuts

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