clients

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package clients provides client management functionality for the GoBroke system.

Package clients provides client management functionality for the GoBroke system. It handles client creation, metadata management, and tracking of client activity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithUUID

func WithUUID(uuid string) clientOptsFunc

WithUUID returns a clientOptsFunc that sets a custom UUID for a client. If not used, a new random UUID will be generated by default.

Types

type Client

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

Client represents a connected client in the GoBroke system. Each client has a unique identifier, optional metadata, and activity tracking.

func New

func New(opts ...clientOptsFunc) *Client

New creates a new Client instance with the provided options. Options can include custom UUID and metadata configurations.

func (*Client) AddMetadata

func (c *Client) AddMetadata(name string, value any)

AddMetadata associates a key-value pair with the client. This can be used to store custom data related to the client.

func (*Client) GetLastMessage

func (c *Client) GetLastMessage() time.Time

GetLastMessage returns the timestamp of the client's most recent message.

func (*Client) GetMetadata

func (c *Client) GetMetadata(name string) any

GetMetadata retrieves the value associated with the given metadata key. Returns nil if the key doesn't exist.

func (*Client) GetUUID

func (c *Client) GetUUID() string

GetUUID returns the client's unique identifier.

func (*Client) SetLastMessageNow

func (c *Client) SetLastMessageNow()

SetLastMessageNow updates the client's last message timestamp to the current time. This is typically called when the client sends a new message.

Jump to

Keyboard shortcuts

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