Skip to content

Commit

Permalink
Added MaxPingsOutstanding, fixes #414
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <[email protected]>
  • Loading branch information
derekcollison committed Dec 13, 2018
1 parent 13c7fc7 commit dd1ef15
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,15 +633,24 @@ func MaxReconnects(max int) Option {
}
}

// PingInterval is an Option to set the period for client ping commands
// PingInterval is an Option to set the period for client ping commands.
func PingInterval(t time.Duration) Option {
return func(o *Options) error {
o.PingInterval = t
return nil
}
}

// ReconnectBufSize sets the buffer size of messages kept while busy reconnecting
// MaxPingsOutstanding is an Option to set the maximum number of ping requests
// that can go un-answered by the server before closing the connection.
func MaxPingsOutstanding(max int) Option {
return func(o *Options) error {
o.MaxPingsOut = max
return nil
}
}

// ReconnectBufSize sets the buffer size of messages kept while busy reconnecting.
func ReconnectBufSize(size int) Option {
return func(o *Options) error {
o.ReconnectBufSize = size
Expand Down

0 comments on commit dd1ef15

Please sign in to comment.