added close

nats
Paulo Simão 2021-10-07 04:32:21 -03:00
parent 284cc4eb1a
commit 23d1d9dd1d
1 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,15 @@ func (p *PSCli) Read(i interface{}) error {
return json.Unmarshal(bs, i)
}
func (p *PSCli) Close() error {
if !p.closed {
p.closed = true
close(p.ch)
return p.con.Close()
}
return nil
}
func NewCli(q string) (*PSCli, error) {
ret := &PSCli{}
ret.q = q