Documentation
¶
Overview ¶
Package ws implements the WebSocket client for Flashduty communication.
Index ¶
- Constants
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) EnvironmentID() string
- func (c *Client) Labels() []string
- func (c *Client) Name() string
- func (c *Client) Run(ctx context.Context) error
- func (c *Client) RunWithReconnect(ctx context.Context) error
- func (c *Client) Send(msg *protocol.Message) error
- func (c *Client) SendPayload(msgType protocol.MessageType, payload any) error
- type Handler
- type MessageHandler
Constants ¶
View Source
const (
// DefaultMaxReconnectAttempts is the default max reconnect attempts (0 = unlimited).
DefaultMaxReconnectAttempts = 30
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the WebSocket client for Flashduty communication.
func NewClient ¶
func NewClient(token, apiURL, workspaceRoot string, handler MessageHandler, version string, maxAttempts int) *Client
NewClient creates a new WebSocket client. maxAttempts controls reconnection: 0 = unlimited, >0 = max attempts before giving up.
func (*Client) EnvironmentID ¶ added in v0.0.6
EnvironmentID returns the environment ID assigned by Flashduty.
func (*Client) RunWithReconnect ¶
RunWithReconnect runs the client with automatic reconnection.
func (*Client) SendPayload ¶
func (c *Client) SendPayload(msgType protocol.MessageType, payload any) error
SendPayload sends a message with the given type and payload.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles incoming WebSocket messages.
func NewHandler ¶
func NewHandler(ws *environment.Environment) *Handler
NewHandler creates a new message handler.
func (*Handler) CancelAllTasks ¶
func (h *Handler) CancelAllTasks()
CancelAllTasks cancels all running tasks.
func (*Handler) RunningTaskCount ¶
RunningTaskCount returns the number of running tasks.
Click to show internal directories.
Click to hide internal directories.