Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientConfig ¶
type ClientConfig struct {
// Endpoint is the SSE server URL.
Endpoint string
// RetryInterval in milliseconds for reconnection.
RetryInterval int
// MaxRetryDelay caps the exponential backoff.
MaxRetryDelay int
// MaxReconnectAttempts limits retry attempts. 0 = unlimited.
MaxReconnectAttempts int
}
ClientConfig holds configuration strictly for the Browser/WASM Client.
type Config ¶
type Config struct {
// Log is the centralized logger function.
// If nil, logging is disabled.
Log func(args ...any)
}
Config holds the shared configuration for both Server and Client.
type SSEClient ¶
type SSEClient struct {
// contains filtered or unexported fields
}
SSEClient is the SSE client for WASM.
func (*SSEClient) Connect ¶
func (c *SSEClient) Connect()
Connect establishes a connection to the SSE endpoint.
func (*SSEClient) OnMessage ¶
func (c *SSEClient) OnMessage(handler func(msg *SSEMessage))
OnMessage sets the handler for incoming messages.
type SSEMessage ¶
type SSEMessage struct {
ID string // SSE "id:" field - Required. Used for Last-Event-ID reconnection.
Event string // SSE "event:" field - Optional. Allows routing to different handlers.
Data []byte // SSE "data:" field - RAW bytes, library does NOT parse.
}
SSEMessage represents a message sent over SSE. Shared by both Server (for broadcasting) and Client (for consumption).
Click to show internal directories.
Click to hide internal directories.