Documentation
¶
Index ¶
- Constants
- func DefaultLogFn(prefix string) func(currentAlloc, peakAlloc uint64)
- func ErrorResponse(w http.ResponseWriter, statusMessage *StatusMessage) error
- func FormatBytes(b uint64) string
- func NilChecker(data any) error
- func ReadPump(c *Client, h *Hub)
- func WritePump(c *Client, h *Hub)
- type Client
- type Hub
- type MemoryMonitor
- type StatusMessage
- type StatusMessageBuilder
Constants ¶
View Source
const MonitorInterval = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
func DefaultLogFn ¶ added in v1.2.3
DefaultLogFn returns a log function with the given prefix.
func ErrorResponse ¶ added in v0.0.43
func ErrorResponse(w http.ResponseWriter, statusMessage *StatusMessage) error
func FormatBytes ¶ added in v1.2.3
func NilChecker ¶
Types ¶
type Client ¶
type Hub ¶
type MemoryMonitor ¶ added in v1.2.3
type MemoryMonitor struct {
// contains filtered or unexported fields
}
func NewMemoryMonitor ¶ added in v1.2.3
func NewMemoryMonitor() *MemoryMonitor
func (*MemoryMonitor) Run ¶ added in v1.2.3
func (m *MemoryMonitor) Run(ctx context.Context, logFn func(currentAlloc, peakAlloc uint64))
Run starts a periodic monitor loop that calls logFn with each snapshot. It blocks until ctx is cancelled.
func (*MemoryMonitor) Snapshot ¶ added in v1.2.3
func (m *MemoryMonitor) Snapshot() (currentAlloc, peakAlloc uint64)
Snapshot reads current heap allocation, updates the peak, and returns both.
type StatusMessage ¶ added in v0.0.43
type StatusMessageBuilder ¶ added in v0.0.43
type StatusMessageBuilder struct {
// contains filtered or unexported fields
}
func NewStatusMessage ¶ added in v0.0.43
func NewStatusMessage() *StatusMessageBuilder
func (*StatusMessageBuilder) Build ¶ added in v0.0.43
func (sm *StatusMessageBuilder) Build() *StatusMessage
func (*StatusMessageBuilder) Message ¶ added in v0.0.43
func (sm *StatusMessageBuilder) Message(message string) *StatusMessageBuilder
func (*StatusMessageBuilder) StatusCode ¶ added in v0.0.43
func (sm *StatusMessageBuilder) StatusCode(statusCode int) *StatusMessageBuilder
Click to show internal directories.
Click to hide internal directories.