Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenNotificationsCmd ¶
func ListenNotificationsCmd(ctx context.Context, notifCh <-chan storage.Notification, processor *xsync.NotificationProcessor, sseClient *sse.Client) tea.Cmd
ListenNotificationsCmd reads from the notification channel, processes the notification via the NotificationProcessor, and returns a NotificationMsg. This command should be re-invoked after each message to continue listening. On successful processing, acknowledges the notification to prevent reprocessing.
func StartSSECmd ¶
func StartSSECmd(ctx context.Context, client *sse.Client, notifCh chan<- storage.Notification) tea.Cmd
StartSSECmd launches a goroutine that connects to the SSE server and pushes notifications to the provided channel. The channel bridges the blocking SSE client with bubbletea's message system.
Types ¶
type Deps ¶
type Deps struct {
Ctx context.Context
Cancel context.CancelFunc
Logger *slog.Logger
TokenChecker oauth.TokenChecker
TokenSource oauth.TokenSource
AuthFlow oauth.Flow
CacheService cache.CacheService
SSEClient *sse.Client
NotifProcessor *xsync.NotificationProcessor
NotificationChan chan storage.Notification
}
type NotificationMsg ¶
type NotificationMsg struct {
Notification storage.Notification
Result xsync.ProcessResult
}
type SSEConnectedMsg ¶
type SSEConnectedMsg struct{}
type SSEDisconnectedMsg ¶
type SSEDisconnectedMsg struct {
Err error
}
Click to show internal directories.
Click to hide internal directories.