MCPcopy
hub / github.com/nats-io/nats.go / SetClosedHandler

Method SetClosedHandler

nats.go:1743–1750  ·  view source on GitHub ↗

SetClosedHandler will set the closed event handler.

(cb ConnHandler)

Source from the content-addressed store, hash-verified

1741
1742// SetClosedHandler will set the closed event handler.
1743func (nc *Conn) SetClosedHandler(cb ConnHandler) {
1744 if nc == nil {
1745 return
1746 }
1747 nc.mu.Lock()
1748 defer nc.mu.Unlock()
1749 nc.Opts.ClosedCB = cb
1750}
1751
1752// ClosedHandler will return the closed event handler.
1753func (nc *Conn) ClosedHandler() ConnHandler {

Callers 11

TestOptionsFunction · 0.45
ConsumeMethod · 0.45
ConsumeMethod · 0.45
MessagesMethod · 0.45
WatchMethod · 0.45
TestAddServiceFunction · 0.45

Calls

no outgoing calls

Tested by 5

TestOptionsFunction · 0.36
TestAddServiceFunction · 0.36