Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultPingInterval = 30 * time.Second MinCapacity = 2 DefaultCapacity = 5 )
Variables ¶
View Source
var (
ErrAllConnectionsAcquired = errors.New("all connections have been acquired")
)
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func DefaultPool ¶
Create a new Websocket Connection Pool using default settings
func NewPool ¶
func NewPool(wsUrl string, config *PoolConfig) *Pool
Create a new Websocket Connection Pool
func (*Pool) GetConnection ¶
Grab a connection from the Pool
func (*Pool) ReleaseConnection ¶
Release a connection so that it goes back to the Pool
type PoolConfig ¶
type PoolConfig struct { // Max number of connections to keep in the Pool. Minimum is 2 connections Capacity uint32 // Function for creating the websocket connection. // // Allows you to define how your websocket connection should be made CreateConn func(string) (*websocket.Conn, error) // How often your websocket should ping the server to // keep the connection alive PingInterval time.Duration }
Click to show internal directories.
Click to hide internal directories.