sse

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublishAuditLogsChanged

func PublishAuditLogsChanged()

PublishAuditLogsChanged notifies clients that audit logs have changed

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 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 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 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

func (*Client) Close

func (c *Client) Close()

Close unregisters a client from the hub

func (*Client) Send

func (c *Client) Send() <-chan []byte

Send returns the channel for receiving events

type Event

type Event struct {
	Type    EventType   `json:"type"`
	Payload interface{} `json:"payload,omitempty"`
}

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"
	EventStackDefinitionsChanged EventType = "stack-definitions:changed"
	EventStackDefinitionsDeleted EventType = "stack-definitions:deleted"
	EventTunnelsChanged          EventType = "tunnels:changed"
	EventTunnelsDeleted          EventType = "tunnels:deleted"
	EventAuditLogsChanged        EventType = "auditlogs:changed"

	// Space events for frequently changing data
	EventSpaceChanged EventType = "space:changed"
	EventSpaceDeleted EventType = "space:deleted"

	// Authentication events
	EventAuthRequired EventType = "auth:required"
)

Resource change events - *:changed for creates/updates, *:deleted for deletions

type Hub

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

Hub manages all SSE client connections and event broadcasting

func GetHub

func GetHub() *Hub

GetHub returns the singleton SSE hub instance

func (*Hub) Broadcast

func (h *Hub) Broadcast(event *Event)

Broadcast sends an event to all connected clients

func (*Hub) InvalidateSession

func (h *Hub) InvalidateSession(sessionId string)

InvalidateSession sends an auth required event to all clients with a specific session

func (*Hub) NewClient

func (h *Hub) NewClient(userId, sessionId string) *Client

NewClient creates a new SSE client and registers it with the hub

func (*Hub) Shutdown

func (h *Hub) Shutdown()

Shutdown closes all client connections and stops the hub

func (*Hub) Start

func (h *Hub) Start()

Start begins the hub's event processing loop

type ResourcePayload

type ResourcePayload struct {
	Id                string   `json:"id"`
	UserId            string   `json:"user_id,omitempty"`
	SharedWithUserIds []string `json:"shared_with_user_ids,omitempty"`
	PreviousUserIds   []string `json:"previous_user_ids,omitempty"`
}

ResourcePayload contains data for resource-specific events

Jump to

Keyboard shortcuts

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