node

package
v1.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AckV2Events

func AckV2Events(uuid string, ackIDs []string)

func AdminAddClient

func AdminAddClient(ctx context.Context, req *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminClearRecords

func AdminClearRecords(ctx context.Context, _ *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminEditClient

func AdminEditClient(ctx context.Context, req *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminGetClient

func AdminGetClient(_ context.Context, req *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminGetClientToken

func AdminGetClientToken(_ context.Context, req *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminListClients

func AdminListClients(_ context.Context, _ *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminOrderClients

func AdminOrderClients(ctx context.Context, req *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func AdminRemoveClient

func AdminRemoveClient(ctx context.Context, req *rpc.JsonRpcRequest) (any, *rpc.JsonRpcError)

func DeleteClientConditionally

func DeleteClientConditionally(uuid string, connToRemove *wsconn.SafeConn)

func DeleteConnectedClients

func DeleteConnectedClients(uuid string)

func DeleteLatestReport

func DeleteLatestReport(uuid string)

func DeleteV2EventQueue

func DeleteV2EventQueue(uuid string)

DeleteV2EventQueue drops a client's pull-based event queue. Callers must invoke this when a client is deleted; the queue is otherwise never removed on its own, since an empty queue with no pending events looks the same as one that simply hasn't been pruned yet.

func DispatchPing

func DispatchPing(uuid string, params protocol.PingParams) bool

func DispatchV2Event

func DispatchV2Event(uuid, method string, params any) bool

func EnqueueV2Event

func EnqueueV2Event(uuid, method string, params any) protocol.Event

func GetAllOnlineUUIDs

func GetAllOnlineUUIDs() []string

GetAllOnlineUUIDs returns a de-duplicated list of online UUIDs from both WebSocket and non-WebSocket agents.

func GetClients

func GetClients(c *gin.Context)

func GetConnectedClients

func GetConnectedClients() map[string]*wsconn.SafeConn

func GetLatestReport

func GetLatestReport() map[string]*protocol.Report

func GetRecentReports

func GetRecentReports(uuid string) []protocol.Report

func IsAgentOnline

func IsAgentOnline(uuid string) bool

func IsV2Client

func IsV2Client(uuid string) bool

func KeepAlivePresence

func KeepAlivePresence(uuid string, connectionID int64, ttl time.Duration)

SetPresence sets or clears presence for non-WebSocket agents. When present=false, it only clears if the connectionID matches current one. KeepAlivePresence sets presence with TTL for non-WebSocket agents.

func MarkV2Client

func MarkV2Client(uuid string)

func OnOffline

func OnOffline(hook PresenceHook)

OnOffline registers a hook to run whenever a client goes offline.

func OnOnline

func OnOnline(hook PresenceHook)

OnOnline registers a hook to run whenever a client comes online.

func RecordReport

func RecordReport(report protocol.Report)

RecordReport updates the latest runtime state and keeps only the short raw window used by recent-status compatibility endpoints.

func RegisterClient

func RegisterClient(c *gin.Context)

func SetConnectedClients

func SetConnectedClients(uuid string, conn *wsconn.SafeConn)

func SetDefaultPingTaskApplier

func SetDefaultPingTaskApplier(fn func(clientUUID string) error)

SetDefaultPingTaskApplier registers the function used to apply default-on ping tasks to a newly created client.

func SetPingResultRecorder

func SetPingResultRecorder(fn func(models.PingRecord) error)

SetPingResultRecorder registers the function used to persist a ping result reported by an agent.

func SetPresence

func SetPresence(uuid string, connectionID int64, present bool)

SetPresence keeps compatibility with existing callers.

func TakeV2Events

func TakeV2Events(uuid string, ackIDs []string, limit int) []protocol.Event

func UploadV2RPC

func UploadV2RPC(c *gin.Context)

func WaitV2Events

func WaitV2Events(uuid string, ackIDs []string, timeout time.Duration) []protocol.Event

func WebSocketV2RPC

func WebSocketV2RPC(c *gin.Context)

Types

type PresenceHook

type PresenceHook func(uuid string, connID int64)

PresenceHook is invoked when a client's connectivity state changes. It exists so this package doesn't need to import internal/features/notification directly: notification already depends on this package for connection/report state, so the reverse edge is registered here instead of imported there.

Jump to

Keyboard shortcuts

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