ws

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ws provides a WebSocket client for receiving real-time sync notifications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a Todoist WebSocket client.

func NewClient

func NewClient(url string, handler Handler, logger *log.Logger) *Client

func (*Client) Close

func (c *Client) Close() error

Close stops the WebSocket client and closes the connection.

func (*Client) Listen

func (c *Client) Listen(ctx context.Context)

Listen starts the WebSocket client to listen for incoming messages.

type Handler

type Handler interface {
	// HandleMessage handles incoming WebSocket messages.
	HandleMessage(ctx context.Context, msg Message) error
}

Handler defines the interface for handling WebSocket messages.

type Message

type Message string
const (
	Connected    Message = "connected"
	Disconnected Message = "disconnected"

	Ping            Message = "ping"
	SyncNeeded      Message = "sync_needed"
	CalenderUpdated Message = "calendar_updated"
)

Jump to

Keyboard shortcuts

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