Documentation
¶
Index ¶
- func PublishAuditLogsChanged()
- func PublishEventSinksChanged(sinkId string)
- func PublishEventSinksDeleted(sinkId string)
- func PublishFilesChanged(userId string, bucketIds []string, changes []FileChange)
- func PublishGroupsChanged(groupId string)
- func PublishGroupsDeleted(groupId string)
- func PublishMCPServersChanged(serverId string)
- func PublishMCPServersDeleted(serverId string)
- func PublishPoolChanged(poolId string)
- func PublishPoolDeleted(poolId string)
- func PublishPortForwardChanged(spaceId, userId string)
- func PublishRolesChanged(roleId string)
- func PublishRolesDeleted(roleId string)
- func PublishScriptsChanged(scriptId string)
- func PublishScriptsDeleted(scriptId string)
- func PublishSessionsChanged(sessionId string)
- func PublishSessionsDeleted(sessionId string)
- func PublishSkillsChanged(skillId string)
- func PublishSkillsDeleted(skillId string)
- func PublishSlashCommandsChanged(commandId string)
- func PublishSlashCommandsDeleted(commandId string)
- func PublishSpaceChanged(spaceId, userId string)
- func PublishSpaceChangedWithShares(spaceId, userId string, sharedWithUserIds []string, previousUserIds []string)
- func PublishSpaceDeleted(spaceId, userId string)
- func PublishStackDefinitionsChanged(defId string)
- func PublishStackDefinitionsDeleted(defId string)
- func PublishTemplateVarsChanged(templateVarId string)
- func PublishTemplateVarsDeleted(templateVarId string)
- func PublishTemplatesChanged(templateId string)
- func PublishTemplatesDeleted(templateId string)
- func PublishTokensChanged(tokenId string)
- func PublishTokensDeleted(tokenId string)
- func PublishTunnelsChanged(userId string)
- func PublishTunnelsDeleted(tunnelName, userId string)
- func PublishUsersChanged(userId string)
- func PublishUsersDeleted(userId string)
- func PublishVolumesChanged(volumeId string)
- func PublishVolumesDeleted(volumeId string)
- type Client
- type Event
- type EventType
- type FileChange
- type FilesPayload
- type Hub
- func (h *Hub) Broadcast(event *Event)
- func (h *Hub) CloseSession(sessionId string)
- func (h *Hub) InvalidateSession(sessionId string)
- func (h *Hub) NewClient(userId, sessionId string) *Client
- func (h *Hub) SendToUser(userId string, event *Event)
- func (h *Hub) Shutdown()
- func (h *Hub) Start()
- func (h *Hub) UserIds() []string
- type ResourcePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublishAuditLogsChanged ¶
func PublishAuditLogsChanged()
PublishAuditLogsChanged notifies clients that audit logs have changed
func PublishEventSinksChanged ¶ added in v0.28.0
func PublishEventSinksChanged(sinkId string)
func PublishEventSinksDeleted ¶ added in v0.28.0
func PublishEventSinksDeleted(sinkId string)
func PublishFilesChanged ¶ added in v0.37.0
func PublishFilesChanged(userId string, bucketIds []string, changes []FileChange)
PublishFilesChanged tells one user that files or buckets they can see changed in file storage. Clients refetch what they show; an empty list means any bucket. Who may hear of which bucket is decided by the caller.
func PublishGroupsChanged ¶
func PublishGroupsChanged(groupId string)
PublishGroupsChanged notifies clients that a group has changed
func PublishGroupsDeleted ¶
func PublishGroupsDeleted(groupId string)
PublishGroupsDeleted notifies clients that a group was deleted
func PublishMCPServersChanged ¶ added in v0.29.0
func PublishMCPServersChanged(serverId string)
PublishMCPServersChanged notifies clients that an MCP server has changed
func PublishMCPServersDeleted ¶ added in v0.29.0
func PublishMCPServersDeleted(serverId string)
PublishMCPServersDeleted notifies clients that an MCP server was deleted
func PublishPoolChanged ¶ added in v0.28.0
func PublishPoolChanged(poolId string)
PublishPoolChanged notifies clients that a pool was created, updated, or its membership/state changed. Without this, pool changes propagated via gossip never trigger a UI refresh (unlike spaces), so other servers' UIs only update on their slow poll interval.
func PublishPoolDeleted ¶ added in v0.28.0
func PublishPoolDeleted(poolId string)
func PublishPortForwardChanged ¶ added in v0.31.0
func PublishPortForwardChanged(spaceId, userId string)
PublishPortForwardChanged notifies clients that a space's port forwards changed (created, stopped, throttled, or toggled down/up).
func PublishRolesChanged ¶
func PublishRolesChanged(roleId string)
PublishRolesChanged notifies clients that a role has changed
func PublishRolesDeleted ¶
func PublishRolesDeleted(roleId string)
PublishRolesDeleted notifies clients that a role was deleted
func PublishScriptsChanged ¶ added in v0.23.0
func PublishScriptsChanged(scriptId string)
PublishScriptsChanged notifies clients that a script has changed
func PublishScriptsDeleted ¶ added in v0.23.0
func PublishScriptsDeleted(scriptId string)
PublishScriptsDeleted notifies clients that a script was deleted
func PublishSessionsChanged ¶
func PublishSessionsChanged(sessionId string)
PublishSessionsChanged notifies clients that a session has changed
func PublishSessionsDeleted ¶
func PublishSessionsDeleted(sessionId string)
PublishSessionsDeleted notifies clients that a session was deleted
func PublishSkillsChanged ¶ added in v0.23.0
func PublishSkillsChanged(skillId string)
PublishSkillsChanged notifies clients that a skill has changed
func PublishSkillsDeleted ¶ added in v0.23.0
func PublishSkillsDeleted(skillId string)
PublishSkillsDeleted notifies clients that a skill was deleted
func PublishSlashCommandsChanged ¶ added in v0.29.0
func PublishSlashCommandsChanged(commandId string)
PublishSlashCommandsChanged notifies clients that a slash command has changed
func PublishSlashCommandsDeleted ¶ added in v0.29.0
func PublishSlashCommandsDeleted(commandId string)
PublishSlashCommandsDeleted notifies clients that a slash command was deleted
func PublishSpaceChanged ¶
func PublishSpaceChanged(spaceId, userId string)
PublishSpaceChanged notifies clients that a space was created, updated, or state changed.
func PublishSpaceChangedWithShares ¶ added in v0.24.0
func PublishSpaceChangedWithShares(spaceId, userId string, sharedWithUserIds []string, previousUserIds []string)
PublishSpaceChangedWithShares includes share membership changes for clients that need to update filtered lists without a full page refresh.
func PublishSpaceDeleted ¶
func PublishSpaceDeleted(spaceId, userId string)
PublishSpaceDeleted notifies clients that a space was deleted
func PublishStackDefinitionsChanged ¶ added in v0.24.0
func PublishStackDefinitionsChanged(defId string)
PublishStackDefinitionsChanged notifies clients that a stack definition has changed
func PublishStackDefinitionsDeleted ¶ added in v0.24.0
func PublishStackDefinitionsDeleted(defId string)
PublishStackDefinitionsDeleted notifies clients that a stack definition was deleted
func PublishTemplateVarsChanged ¶
func PublishTemplateVarsChanged(templateVarId string)
PublishTemplateVarsChanged notifies clients that a template variable has changed
func PublishTemplateVarsDeleted ¶
func PublishTemplateVarsDeleted(templateVarId string)
PublishTemplateVarsDeleted notifies clients that a template variable was deleted
func PublishTemplatesChanged ¶
func PublishTemplatesChanged(templateId string)
PublishTemplatesChanged notifies clients that a template has changed
func PublishTemplatesDeleted ¶
func PublishTemplatesDeleted(templateId string)
PublishTemplatesDeleted notifies clients that a template was deleted
func PublishTokensChanged ¶
func PublishTokensChanged(tokenId string)
PublishTokensChanged notifies clients that a token has changed
func PublishTokensDeleted ¶
func PublishTokensDeleted(tokenId string)
PublishTokensDeleted notifies clients that a token was deleted
func PublishTunnelsChanged ¶
func PublishTunnelsChanged(userId string)
PublishTunnelsChanged notifies clients that a tunnel was created. The tunnel list is per-user (served from the local in-memory session map), so clients re-fetch /api/tunnels on receipt.
func PublishTunnelsDeleted ¶
func PublishTunnelsDeleted(tunnelName, userId string)
PublishTunnelsDeleted notifies clients that a tunnel was removed. tunnelName is the <user>--<name> identifier matching the "name" field in /api/tunnels.
func PublishUsersChanged ¶
func PublishUsersChanged(userId string)
PublishUsersChanged notifies clients that a user has changed
func PublishUsersDeleted ¶
func PublishUsersDeleted(userId string)
PublishUsersDeleted notifies clients that a user was deleted
func PublishVolumesChanged ¶
func PublishVolumesChanged(volumeId string)
PublishVolumesChanged notifies clients that a volume has changed
func PublishVolumesDeleted ¶
func PublishVolumesDeleted(volumeId string)
PublishVolumesDeleted notifies clients that a volume was deleted
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connected SSE client
type Event ¶
type Event struct {
Type EventType `json:"type" msgpack:"type"`
Payload interface{} `json:"payload,omitempty" msgpack:"payload,omitempty"`
// contains filtered or unexported fields
}
Event represents an SSE event to be sent to clients
type EventType ¶
type EventType string
EventType represents the type of SSE event
const ( EventGroupsChanged EventType = "groups:changed" EventGroupsDeleted EventType = "groups:deleted" EventRolesChanged EventType = "roles:changed" EventRolesDeleted EventType = "roles:deleted" EventTemplatesChanged EventType = "templates:changed" EventTemplatesDeleted EventType = "templates:deleted" EventTemplateVarsChanged EventType = "templatevars:changed" EventTemplateVarsDeleted EventType = "templatevars:deleted" EventUsersChanged EventType = "users:changed" EventUsersDeleted EventType = "users:deleted" EventTokensChanged EventType = "tokens:changed" EventTokensDeleted EventType = "tokens:deleted" EventVolumesChanged EventType = "volumes:changed" EventVolumesDeleted EventType = "volumes:deleted" EventSessionsChanged EventType = "sessions:changed" EventSessionsDeleted EventType = "sessions:deleted" EventScriptsChanged EventType = "scripts:changed" EventScriptsDeleted EventType = "scripts:deleted" EventSkillsChanged EventType = "skills:changed" EventSkillsDeleted EventType = "skills:deleted" EventSlashCommandsChanged EventType = "slashcommands:changed" EventSlashCommandsDeleted EventType = "slashcommands:deleted" EventStackDefinitionsChanged EventType = "stack-definitions:changed" EventStackDefinitionsDeleted EventType = "stack-definitions:deleted" EventMCPServersChanged EventType = "mcp-servers:changed" EventMCPServersDeleted EventType = "mcp-servers:deleted" EventTunnelsChanged EventType = "tunnels:changed" EventTunnelsDeleted EventType = "tunnels:deleted" EventAuditLogsChanged EventType = "auditlogs:changed" EventEventSinksChanged EventType = "eventsinks:changed" EventEventSinksDeleted EventType = "eventsinks:deleted" // Space events for frequently changing data EventSpaceChanged EventType = "space:changed" EventSpaceDeleted EventType = "space:deleted" // Port forward events EventPortForwardChanged EventType = "port-forward:changed" // Pool events EventPoolChanged EventType = "pool:changed" EventPoolDeleted EventType = "pool:deleted" // File storage: files or buckets changed, here or on another server EventFilesChanged EventType = "files:changed" // Authentication events EventAuthRequired EventType = "auth:required" )
Resource change events - *:changed for creates/updates, *:deleted for deletions
type FileChange ¶ added in v0.41.0
type FileChange struct {
BucketId string `json:"bucket_id" msgpack:"bucket_id"`
Key string `json:"key" msgpack:"key"`
Writer string `json:"writer,omitempty" msgpack:"writer,omitempty"`
}
FileChange is a file that changed, and the client that changed it when it said (the X-Knot-Writer header), so that client can pass over its own.
type FilesPayload ¶ added in v0.37.0
type FilesPayload struct {
BucketIds []string `json:"bucket_ids,omitempty" msgpack:"bucket_ids,omitempty"`
Changes []FileChange `json:"changes,omitempty" msgpack:"changes,omitempty"`
}
FilesPayload names the buckets whose files or settings changed. It is empty when too many changed to name, meaning any of them might have. Changes names the files that changed, for the buckets where they can be named; a bucket in BucketIds without changes here changed as a whole.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages all SSE client connections and event broadcasting
func (*Hub) CloseSession ¶ added in v0.34.4
CloseSession drops every SSE stream of a session without the logout signal: the clients' send channels close, their streams end, and the browsers reconnect as the session's current user. Fast user switching uses this — the session stays valid, only the identity it carries changed, so the clients must not receive auth:required (the client answers that by navigating to /logout, which would delete the just-switched session from any tab that lost the navigation race).
func (*Hub) InvalidateSession ¶
InvalidateSession sends an auth required event to all clients with a specific session
func (*Hub) SendToUser ¶ added in v0.37.0
SendToUser sends an event to one user's connected clients.
type ResourcePayload ¶
type ResourcePayload struct {
Id string `json:"id" msgpack:"id"`
UserId string `json:"user_id,omitempty" msgpack:"user_id,omitempty"`
PreviousUserIds []string `json:"previous_user_ids,omitempty" msgpack:"previous_user_ids,omitempty"`
}
ResourcePayload contains data for resource-specific events