websocket

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PerfTestWebsocketCMD

func PerfTestWebsocketCMD() *cobra.Command

PerfTestWebsocketCMD creates a cobra command for websocket performance test

Types

type Client

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

Client represents a single WebSocket client worker.

func NewClient

func NewClient(id int, url string, stats *statsCollector, sendInterval time.Duration, payloadData []byte, isJSON bool) *Client

NewClient creates a new WebSocket client worker.

func (*Client) Dial

func (c *Client) Dial(ctx context.Context) error

Dial establishes a WebSocket connection to the server.

func (*Client) Run

func (c *Client) Run(ctx context.Context, wg *sync.WaitGroup)

Run starts the client worker.

type ErrSet

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

func NewErrSet

func NewErrSet() *ErrSet

func (*ErrSet) Add

func (s *ErrSet) Add(key string)

func (*ErrSet) List

func (s *ErrSet) List() []string

type Statistics

type Statistics struct {
	URL      string  `json:"url"`      // performed request URL
	Duration float64 `json:"duration"` // seconds

	// Connections
	TotalConnections   uint64  `json:"total_connections"`
	SuccessConnections uint64  `json:"success_connections"`
	FailedConnections  uint64  `json:"failed_connections"`
	AvgConnectLatency  float64 `json:"avg_connect_latency"` // ms
	MinConnectLatency  float64 `json:"min_connect_latency"` // ms
	MaxConnectLatency  float64 `json:"max_connect_latency"` // ms

	// Messages
	TotalMessagesSent     uint64  `json:"total_messages_sent"`
	TotalMessagesReceived uint64  `json:"total_messages_received"`
	SentMessageQPS        float64 `json:"sent_message_qps"`     // sent messages per second
	ReceivedMessageQPS    float64 `json:"received_message_qps"` // received messages per second
	TotalBytesSent        uint64  `json:"total_bytes_sent"`     // bytes
	TotalBytesReceived    uint64  `json:"total_bytes_received"` // bytes

	ErrorCount uint64   `json:"error_count"` // total errors
	Errors     []string `json:"errors"`      // list of errors
}

func (*Statistics) Save

func (s *Statistics) Save(filePath string) error

Jump to

Keyboard shortcuts

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