Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *Options // contains filtered or unexported fields }
Client is a structure representing a client in a WebSocket communication setup. It contains options for configuration, channels for errors and messages, handlers for errors and messages, a map for managing active connections, and a Mutex for safe concurrent access.
func New ¶
New creates a new Client with the given options. It sets up channels for errors and messages, default handlers for errors and messages, and a map for active WebSocket connections.
func (*Client) Connect ¶
Connect establishes a WebSocket connection to the given URL. It adds the new connection to the client's map of connections and starts listening on it.
func (*Client) HandleErrorFunc ¶
HandleErrorFunc sets the function to be called when an error occurs. The function should take an error as its argument.
func (*Client) HandleMessageFunc ¶
HandleMessageFunc sets the function to be called when a message is received. The function should take a message as its argument.