presence

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: 10 Imported by: 0

Documentation

Overview

This package holds the presence interface implementations

This package holds the presence interface implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LedisPresence

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

LedisPresence - Ledis implementation of PresenceHandler

func NewLedisPresence

func NewLedisPresence() *LedisPresence

NewLedisPresence - Create new instance of LedisPresence

func NewLedisPresenceWithDB

func NewLedisPresenceWithDB(db *ledis.DB) *LedisPresence

NewLedisPresence - Create new instance of LedisPresence with given db

func (*LedisPresence) AddDevice

func (presence *LedisPresence) AddDevice(clientID string, deviceID string)

AddDevice - Add client device to connected status

func (*LedisPresence) AddOnlineChannelDevice

func (presence *LedisPresence) AddOnlineChannelDevice(appID string, channelID string, clientID string, deviceID string)

AddOnlineChannelDevice - Add device to channel

func (*LedisPresence) GetChannelAmountOfClientDevices

func (presence *LedisPresence) GetChannelAmountOfClientDevices(appID string, channelID string, clientID string) int64

GetChannelAmountOfClientDevices - Get how many client devices are subscribed to this channel

func (*LedisPresence) GetChannelClientsPresence

func (presence *LedisPresence) GetChannelClientsPresence(appID string, channelID string) map[string]int64

GetChannelClientsPresence - Get channel current presence data

func (*LedisPresence) GetClientDevicesPresences

func (presence *LedisPresence) GetClientDevicesPresences(clientID string) ([]*core.LastDevicePresence, error)

GetClientDevicesPresences - Get all connected devices with their last online timstamp

func (*LedisPresence) GetClientOnlineDevices

func (presence *LedisPresence) GetClientOnlineDevices(clientID string) ([]string, error)

GetClientOnlineDevices - Get all connected client devices

func (*LedisPresence) GetClientTimestamp

func (presence *LedisPresence) GetClientTimestamp(clientID string) int64

func (*LedisPresence) GetDB

func (presence *LedisPresence) GetDB() *ledis.DB

func (*LedisPresence) IsClientDeviceConnectToChannel

func (presence *LedisPresence) IsClientDeviceConnectToChannel(appID string, channelID string, clientID string, deviceID string) bool

IsClientDeviceConnectToChannel - Check if device is connected to channel, this will be mostly used to prevent online status constantly changing

func (*LedisPresence) IsOnline

func (presence *LedisPresence) IsOnline(clientID string) bool

IsOnline - Check if client is online by checking connected devices

func (*LedisPresence) RemoveDevice

func (presence *LedisPresence) RemoveDevice(clientID string, deviceID string)

RemoveDevice - Remove client device from connected status

func (*LedisPresence) RemoveOnlineChannelDevice

func (presence *LedisPresence) RemoveOnlineChannelDevice(appID string, channelID string, clientID string, deviceID string)

RemoveOnlineChannelDevice - Remove device from channel

func (*LedisPresence) SetDeviceOffline

func (presence *LedisPresence) SetDeviceOffline(clientID string, deviceID string)

SetDeviceOffline - Set device offline

func (*LedisPresence) SetDeviceOnline

func (presence *LedisPresence) SetDeviceOnline(clientID string, deviceID string)

SetDeviceOnline - Set device online

func (*LedisPresence) UpdateClientTimestamp

func (presence *LedisPresence) UpdateClientTimestamp(clientID string)

func (*LedisPresence) UpdateDeviceTimestamp

func (presence *LedisPresence) UpdateDeviceTimestamp(clientID string, deviceID string)

UpdateDeviceTimestamp - Update client device connected status

type RedisPresence

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

RedisPresence - Redis implementation of PresenceHandler

func NewRedisPresence

func NewRedisPresence() *RedisPresence

NewRedisPresence - Create new instance of RedisPresence

func (*RedisPresence) AddDevice

func (presence *RedisPresence) AddDevice(clientID string, deviceID string)

AddDevice - Add client device to connected status

func (*RedisPresence) AddOnlineChannelDevice

func (presence *RedisPresence) AddOnlineChannelDevice(appID string, channelID string, clientID string, deviceID string)

AddOnlineChannelDevice - Add device to channel

func (*RedisPresence) GetChannelAmountOfClientDevices

func (presence *RedisPresence) GetChannelAmountOfClientDevices(appID string, channelID string, clientID string) int64

GetChannelAmountOfClientDevices - Get how many client devices are subscribed to this channel

func (*RedisPresence) GetChannelClientsPresence

func (presence *RedisPresence) GetChannelClientsPresence(appID string, channelID string) map[string]int64

GetChannelClientsPresence - Get channel current presence data

func (*RedisPresence) GetClientDevicesPresences

func (presence *RedisPresence) GetClientDevicesPresences(clientID string) ([]*core.LastDevicePresence, error)

GetClientDevicesPresences - Get all connected devices with their last online timstamp

func (*RedisPresence) GetClientOnlineDevices

func (presence *RedisPresence) GetClientOnlineDevices(clientID string) ([]string, error)

GetClientOnlineDevices - Get all connected client devices

func (*RedisPresence) GetClientTimestamp

func (presence *RedisPresence) GetClientTimestamp(clientID string) int64

func (*RedisPresence) IsClientDeviceConnectToChannel

func (presence *RedisPresence) IsClientDeviceConnectToChannel(appID string, channelID string, clientID string, deviceID string) bool

IsClientDeviceConnectToChannel - Check if device is connected to channel, this will be mostly used to prevent online status constantly changing

func (*RedisPresence) IsOnline

func (presence *RedisPresence) IsOnline(clientID string) bool

IsOnline - Check if client is online by checking connected devices

func (*RedisPresence) RemoveDevice

func (presence *RedisPresence) RemoveDevice(clientID string, deviceID string)

RemoveDevice - Remove client device from connected status

func (*RedisPresence) RemoveOnlineChannelDevice

func (presence *RedisPresence) RemoveOnlineChannelDevice(appID string, channelID string, clientID string, deviceID string)

RemoveOnlineChannelDevice - Remove device from channel

func (*RedisPresence) SetDeviceOffline

func (presence *RedisPresence) SetDeviceOffline(clientID string, deviceID string)

SetDeviceOffline - Set device offline

func (*RedisPresence) SetDeviceOnline

func (presence *RedisPresence) SetDeviceOnline(clientID string, deviceID string)

SetDeviceOnline - Set device online

func (*RedisPresence) UpdateClientTimestamp

func (presence *RedisPresence) UpdateClientTimestamp(clientID string)

presence.client.Set(presence.ctx, appID+":channel:"+channelID+":client: " + clientID + "presence", deviceID, 20 * time.Second)

func (*RedisPresence) UpdateDeviceTimestamp

func (presence *RedisPresence) UpdateDeviceTimestamp(clientID string, deviceID string)

UpdateDeviceTimestamp - Update client device connected status

Jump to

Keyboard shortcuts

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